实时服务器上的邮件问题


Mail issue on live server

我使用php邮件功能发送电子邮件。在我的开发服务器中,它工作正常,但在实时服务器中,电子邮件进入垃圾邮件文件夹。

<?php
    $to = "example@gmail.com";
    $subject = "Registration";
    $from = "example1@gmail.com";
    $content = "Test";
    $headers = "From: Test <" . strip_tags($from) . ">'r'n";
    $headers .= "MIME-Version:1.0" ."'r'n";
    $headers .= "Content-type:text/html;charset=iso-8859-1" . "'r'n";
    $headers .= "X-Priority: 3'r'n";
    $headers .= "X-Mailer: PHP". phpversion() ."'r'n";
    $res = mail($to,$subject,$content,$headers);
    $headers = "From: Test <" . strip_tags($to) . ">'r'n";
    $headers .= "MIME-Version:1.0" ."'r'n";
    $headers .= "Content-type:text/html;charset=iso-8859-1" . "'r'n";
    $headers .= "X-Priority: 3'r'n";
    $headers .= "X-Mailer: PHP". phpversion() ."'r'n";
    $res2 = mail($from,$subject,$content,$headers);

问题很简单,PHP-Mail函数没有使用配置良好的SMTP服务器。

如今,电子邮件

客户端和服务器对电子邮件发送服务器执行大量检查,例如反向DNS查找,灰名单等。所有这些测试都将因 php mail() 函数而失败。如果您使用的是动态IP,那就更糟了。

使用

PHPMailer-Class 并将其配置为使用 smtp-auth 以及配置良好的专用 SMTP 服务器(本地服务器或远程服务器),您的问题就消失了。

https://github.com/PHPMailer/PHPMailer

回答者:多格诺斯先生

并使用完整的标题.. http://www.velvetblues.com/web-development-blog/avoid-spam-filters-with-php-mail-emails/

使用php邮件功能防止已发送的电子邮件被视为垃圾邮件