我真的被困住了。我正在生成的电子邮件为信封发件人设置了没有人的 apache 地址。
这是我的 PHP 代码:
$to = $emailresult;
include 'inc/msg/resetpassword.php';
if(mail($to, $subject, $body, $headers, '-f' . $from)) {
echo 'A temporary password has been sent to ' . $emailresult . '. Please check your inbox and logon with your new password';
} else {
echo("Message delivery failed...");
}
第 2 行包含的文件
<?php
$subject = "XXXClient Dashboard - Password Reset Request Received";
$headers .= "From: XXX Alert <".$from.">\r\n" . "Reply-To: XXXSupport <support@XXX.com>\r\n" . "X-Mailer: PHP/" . phpversion() . "\r\nX-originating-IP: XXX.167.43.105\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$body = $email_header . '
<h1 style="color: #666666;font-weight: normal;font-size: 18px;text-align: center;padding: 0;margin: 0;">We have recieved a request to reset your password. </h1>
<p>Hello,
<br>
Your new temporary password is <b>' . $passwordresult .
'</b>. You may logon to the <a style="color:#8A2BE2; text-decoration:none; font-weight:bold;" href="'. $site_url . '">XX Client Dashboard</a> with your email address and temporary password, then visit the profile section where you can choose a new password.</p>
' . $email_footer;
?>
这是我收到的电子邮件来源:http: //pastebin.com/nbGUaHP1
可以很好地处理我的工作电子邮件,但是当我发送到 gmail 时,它总是会变成垃圾邮件。我正确设置了 -f 标志,但它不想更改信封发件人,所以我相信这就是问题所在。有人知道为什么信封发件人不会使用此代码设置吗?