PHP邮件转到Gmail中的垃圾邮件文件夹

时间:2016-02-08 10:24:19

标签: php email

我的代码看起来像这样

$to = "mymailid@gmail.com";
$subject = "sample subject";
$body = "<div> hi hi .. </div>";
$headers = "Reply-To: The Sender <mymailid@gmail.com>\r\n"; 
$headers .= "Return-Path: The Sender <mymailid@gmail.com>\r\n";
$headers .= "From: The Sender <mymailid@gmail.com>\r\n"; 
$headers .='X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 

mail($to, $subject, $body,$headers)

我已经在我的邮件功能中发送了suitalbe标题。每当我运行此代码时,我的邮件将转到我的Gmail帐户中的垃圾邮件文件夹。如何避免我的邮件进入垃圾邮件文件夹?

1 个答案:

答案 0 :(得分:0)

可以通过传递完整的标题信息来修复,通知邮件提供商,因为发件人是受信任的域(https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail)也涉及一些DNS设置。
您可以在此处找到详细信息:

http://www.velvetblues.com/web-development-blog/avoid-spam-filters-with-php-mail-emails/

https://www.digitalocean.com/community/questions/email-goes-to-spam-gmail-php