PHP脚本拒绝发送到Outlook.com

时间:2015-01-27 20:13:12

标签: php email

对于许多人来说,这似乎是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未发送。请联系您的Internet服务提供商     因为他们的部分网络在我们的阻止名单上。

1 个答案:

答案 0 :(得分:0)

您重新定义了标题几次。您需要以下内容:

$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。最后,您的标题如下:

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

您覆盖了旧From标题,因此这可能会使Outlook认为它是垃圾邮件并立即将其列入黑名单(因此它甚至无法访问垃圾邮件文件夹)

相关问题