我已经使用了这个PHP邮件脚本一段时间了,它很适合我......我需要问一些事情。
现在,它只是发送一封电子邮件给我发布的信息。
然后,如果成功提交,则只有Echo回复用户。
如何添加CC字段以向用户发送下一步操作方向?
感谢
if (isset($_POST['submit'])) {
if (!$_POST['name'] | !$_POST['email'])
{
echo"<div class='error'>Error<br />You did not fill in a required field, please review your form and correct the missing information.</div>";
}
else
{
$name = $_POST['name'];
$email = $_POST['email'];
$email2 = $_POST['email2'];
$legal = $_POST['legal'];
$legal2 = $_POST['legal2'];
$address = $_POST['address'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$comments = $_POST['comments'];
$yoursite = "See Me Shine Models";
$youremail = $email;
$subject = "Website Model Form";
$message = "$name would like you to contact them about See Me Shine Models.
Contact PH: $phone
Email: $email
Email2: $email2
Legal: $legal
Legal2: $legal2
Address: $address
Address2: $address2
City: $city
State: $state
Zip: $zip
Phone: $phone
Comments: $comments";
$email3 = "myaddress@me.com";
mail($email3, $subject, $message, "From: $email");
echo"<div class='thankyou'>Thank you for contacting us,<br /> we will respond as soon as we can.</div>";
}
}
答案 0 :(得分:3)
您需要指定标题的第四个参数:
$xheaders = "";
$xheaders .= "From: Name-Here. <$email>\n";
$xheaders .= "X-Sender: <$email>\n";
$xheaders .= "X-Mailer: PHP\n"; // mailer
$xheaders .= "X-Priority: 1\n"; //1 Urgent Message, 3 Normal
$xheaders .= "Content-Type:text/html; charset=\"iso-8859-1\"\n";
$xheaders .= "Cc: cc_email@example.com\n";
.................
mail($email3, $subject, $message, $xheaders);
或者看本教程:
答案 1 :(得分:1)