私は本当に立ち往生しています。私が生成している電子メールには、エンベロープ送信者用に設定された nobody 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 フラグを正しく設定しましたが、エンベロープ送信者を変更したくないので、それが問題だと思います。エンベロープ送信者がこのコードで設定されない理由を知っている人はいますか?