【发布时间】:2014-04-14 14:44:18
【问题描述】:
您好,我有一个自包含的电子邮件表单,因此它不需要任何其他脚本有些可以帮助我
我的电子邮件表格是这样的:
<html>
<head>
<!--[if !IE]><!-->
<link rel="stylesheet" type="text/css" href="Register.css">
<!--<![endif]-->
</head>
<body style="background-color:#303030">
<?php
// display form if user has not clicked submit
if (!isset($_POST["submit"]))
{
?>
<div id="login">
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
<input type="hidden" name="subject" value="can you create me an account"><br/>
Message: <textarea rows="10" cols="40" name="message"></textarea><br/>
first <input type="text" name="first_name" ><br/>
last <input type="text" name="last_name" ><br/>
company <input type="text" name="company" ><br/>
email <input type="text" name="email" ><br/>
Telephone number <input type="text" name="telnr" ><br/>
Description <input type="text" name="Description" ><br/>
<input type="submit" name="submit" value="Submit Feedback">
</form>
</div>
<?php
}
else
// the user has submitted the form
{
// Check if the "subject" input field is filled out
var_dump($_POST);
if (isset($_POST["subject"]))
{
$subject = $_POST["subject"];
$message = $_POST["message"];
$first = $_POST["first_name"];
$last = $_POST["last_name"];
$company = $_POST["company"];
$email = $_POST["email"];
$telnr = $_POST["telnr"];
$description = $_POST["Description"];
$therest = "First name= $first" . "\r\n" . "Last name= $last" . "\r\n" . "Company= $company" . "\r\n" . "Email= $email" . "\r\n" . "Telnr= $telnr" . "\r\n" . "Description= $description";
}
echo "$therest <br>";
$message = wordwrap($message, 700);
$first = wordwrap($first, 70);
$last = wordwrap($last, 70);
mail("receiver@whatever.co.uk",$subject,$name,$therest,"subject: $subject\n");
echo "Thank you for sending us feedback";
}
?>
</body>
</html>
【问题讨论】:
-
服务器上是否安装了 PEAR MAIL 包? (不需要,但我一直使用它)
-
@Daan 目前没有它没有安装任何想法如何将此表单转换为 smtp 授权表单或任何想法我可以
-
我打算使用 class.phpmailer.php 和 class.smtp.php @Daan
-
从来没有用过那些对不起。只需查看文档。
-
@Daan 你会怎么做??