对于许多人来说,这似乎是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服务提供商 因为他们的部分网络在我们的阻止名单上。
答案 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认为它是垃圾邮件并立即将其列入黑名单(因此它甚至无法访问垃圾邮件文件夹)