我真的被困住了。我正在生成的电子邮件为信封发件人设置了 none 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 标志,但它不想更改信封发件人,所以我相信这就是问题所在。有谁知道为什么信封发件人不会使用此代码进行设置?
我编辑了错误的代码部分。我最终确实让它工作了。即使有信封发件人和 SPF 通行证,我仍然登陆 gmail 垃圾邮件文件夹,这有点糟糕。