为什么我无法发送包含姓名'新消息'到Gmail帐户?

时间:2015-02-09 10:50:47

标签: php email gmail phpmailer

在Windows 8 64位计算机上通过XAMPP运行PHP 5.6。

我正在使用PHPMailer发送电子邮件。如果我这样设置:

    $mail->FromName = 'New Message';

邮件不会传递到我的Gmail帐户。它没有进入垃圾邮件文件夹,我只是没有看到它。此外,PHPMailer显示没有错误。我可以使用相同的FromName将其发送到我的私人域名,我收到的很好。任何其他FromName适用于我的Gmail帐户。

如果我在MS Outlook中将我的名字设置为'新消息'并发送电子邮件到我的Gmail帐户,我收到了电子邮件。

是否有一些我不遵守的RFC准则?

N.B。是的,将FromName作为"新消息"是愚蠢的。这不是故意的,但我不知道为什么这条消息不会被谷歌收到。


PHPMailer设置:

    $this->mail->SMTPDebug = 3;
    $this->mail->isSMTP();                                      // Set mailer to use SMTP
    $this->mail->Host = "myhosting.com";  // Specify main and backup SMTP servers
    $this->mail->SMTPAuth = $this->config["auth"];                               // Enable SMTP authentication
    $this->mail->Username = "myusername@mydomain.com";                 // SMTP username
    $this->mail->Password = "xxxx";                           // SMTP password
    $this->mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
    $this->mail->Port = 465;                                    // TCP port to connect to

    $this->mail->From = $from;
    $this->mail->FromName = $fromName;
    $this->mail->addAddress($to);     // Add a recipient

    $this->mail->isHTML(true);        // Set email format to HTML

    $this->mail->Subject = $subject;
    $this->mail->Body    = $message;

    if(!$this->mail->send()) {
        throw new \Exception("Message could not be sent. Error: ".$this->mail->ErrorInfo);
    }

1 个答案:

答案 0 :(得分:0)

可能是谷歌使用的垃圾邮件的东西,它获得了大量的机器人流量并丢弃了大量不正确配置的邮件。例如,如果将文本放在时间字段中,您应该会看到同样的事情发生。

相关问题