无法正确设置信封发件人,电子邮件会在Gmail中发送垃圾邮件

时间:2013-01-31 14:35:22

标签: php email spam sender

我真的被困住了。我正在生成的电子邮件中包含为信封发件人设置的无人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标志,但它不想更改信封发件人,所以我认为这是问题所在。任何人都知道为什么信封发件人不会使用此代码设置?

1 个答案:

答案 0 :(得分:0)

我正在编辑代码的错误部分。我最终得到了它的工作。即使有信封发件人和SPF通行证,我仍然登陆gmail垃圾邮件文件夹,这种情况很糟糕。