Php 脚本拒绝发送至 Outlook.com

Php Script Refuses to Send to Outlook.com

对于许多人来说,这似乎是 outlook.com 反复出现的问题。

我下面的脚本适用于 @college.edu@gmail.com,但在 outlook.com - 它甚至拒绝访问 junk 文件夹,更不用说 inbox - 我该如何修改它来修复它?

我已经检查了我的发件人域以确保它没有被列入黑名单。

脚本:

<?php
$doraccount = 'noreply@mydomain.com';

$pathwayurl = $_POST['pathway_url'];

$to = $_POST['email_address'];
$subject = "Path Share";
#message for email
$message = '<html><body><div style=width:362px;display:block;margin:0% auto;>';
$message .= "<img src='http://domain.com/sites/default/files/togo3.gif' alt='my site' /></div>";
#$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
#$message .= "<tr style='background: #eee;'></tr>";
$message .= '<div><p>Thank you for using Pathway tool. We have provided you with a link to the below.  Please check out our other programs and offerings on the <a href="http://www.oursite.com">our site website</a></p>';
$message .= "<br /><br /><strong>link:</strong> <tr><td>" . $pathwayurl ."</div>";
$message .= '<div><p>The Team<br /><a href="mailto:info@domain.com">info@domain.com</a></p></div>';;
$message .= "</body></html>";

$headers  = "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-Type: text/html; charset=ISO-8859-1" . PHP_EOL;
$headers .= "From: " . $doraccount . PHP_EOL;

if(mail($to,$subject,$message,$headers)){
    echo "<div style=text-align:center;>
            <img src='http://domain.com/sites/default/files/togo3.gif' alt='domain' /> <br />
            <strong>The email was successfully sent.</strong>
            <br> Redirecting you back to the pathway. 
         </div>";
    header('Refresh: 3;url='.$pathwayurl);
    #echo $message;


} else {
    echo "The email was NOT sent.";
}
?>

日志显示: 很遗憾,来自 xx.xx.xx.xx 未发送。请联系您的互联网服务提供商 因为他们的部分网络在我们的阻止列表中。

你重新定义了你的 header 几次。您想要以下内容:

$headers  = "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-Type: text/html; charset=ISO-8859-1" . PHP_EOL;
$headers = "From: " . $doraccount . "\r\n" . PHP_EOL;

$headers  = "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-Type: text/html; charset=ISO-8859-1" . PHP_EOL;
$headers .= "From: domain<$from>" . PHP_EOL;

首先将 $header 设置为 MIME-Version: 1.0" . PHP_EOL,然后添加 "Content-Type: text/html; charset=ISO-8859-1" . PHP_EOL。然后用 "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-Type: text/html; charset=ISO-8859-1" . PHP_EOL; $headers .= "From: domain<$from>" . PHP_EOL; 覆盖所有以前的数据。下一行清除 $header,并将其设置为 "MIME-Version: 1.0" . PHP_EOL,然后是 "Content-Type: text/html; charset=ISO-8859-1" . PHP_EOL"From: domain<$from>" . PHP_EOL。最后,你的 header 如下:

MIME-Version: 1.0\r\n
Content-Type: text/html; charset=ISO-8859-1\r\n
From: domain<$from>\r\n

您覆盖了旧的 From header,因此这可能会使 Outlook 认为这是垃圾邮件并立即将其列入黑名单(因此它甚至不会到达垃圾邮件文件夹)