0
我有以下代码工作,但没有办法,我希望它mail()函数不会正常工作
if(isset($_POST['edit']) && $_POST['edit']!="")
{
// Email Information
$firstName = $_POST['fname'];
$lastName = $_POST['lname'];
$mobile = $_POST['contactNumber'];
$comments = $_POST['message'];
$email_from = $_POST['email'];
$email_to = "[email protected]";
//$email_headers = "From: ". $firstName ." ". $lastName . " <" . $email_from . ">\r\n" . "Reply-To: [email protected]";
$email_headers = "From: $firstName $lastName <[email protected]>" . "\r\n" . "Reply-To: [email protected]";
$email_subject = "Munster Wedding DJs Inquiry!";
$email_body = "\nName: " . $firstName . " " . $lastName .
"\nEmail: " . $email_from .
"\nPhone Number: " . $mobile .
"\nMessage: " . $comments;
// Send Email
$mailerResult = @mail($email_to, "$email_subject", $email_body,
$email_headers, '-f ' . $email_from);
// Check For Errors
if($mailerResult) {
//echo "Mail Sent!";
echo '<script>document.location.href="thanks.html#anchor"</script>';
exit();
} else {
// echo "Error Sending Email!" . "<br><br>";
// print_r(error_get_last());
}
}
如果我改变
From: $firstName $lastName <[email protected]>"
到
From: $firstName $lastName <$email_from>"
的表格不发送电子邮件? 这是为什么?
我想要做的就是收到电子邮件,当我点击回复时,会将用户的电子邮件地址放入“到”字段。
'如果我从$:$ firstName $ lastName“更改为From:$ firstName $ lastName”'?两者有什么区别? –
“From:$ firstName $ lastName”to From:$ firstName $ lastName“你是什么意思?它们都是一样的东西 –