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「你是什麼意思?它們都是一樣的東西 –