1

我正在使用 PHPMailer 通过 SMTP 发送我的电子邮件。我有一个类,一旦初始化,它就会通过它的 IP 地址自动连接到我的服务器并登录到我的电子邮件帐户。

Snippet from class,

function __construct()
        {
            global $PHPMailer;

            $PHPMailer->IsSMTP();                                     
            $PHPMailer->Host = '67.222.10.87';  
            $PHPMailer->SMTPAuth = true;                               
            $PHPMailer->Username = 'support@networkyourfortune.co.uk';                           
            $PHPMailer->Password = "MYPASSWORD";                      
            $PHPMailer->SMTPSecure = '';        
        }

public function sendEmail($email, $subject, $message, $altMessage) {

            global $PHPMailer;

            $PHPMailer->From = 'support@networkyourfortune.co.uk';
            $PHPMailer->FromName = 'Network Your Fortune';
            $PHPMailer->AddAddress($email); 
            $PHPMailer->AddReplyTo('support@networkyourfortune.co.uk', 'Support');

            $PHPMailer->WordWrap = 50;     
            $PHPMailer->IsHTML(true);  
            $PHPMailer->CharSet = "text/html; charset=UTF-8;"; 

            $PHPMailer->Subject = $subject;
            $PHPMailer->Body = $message;
            $PHPMailer->AltBody  = $altMessage; 

            if($PHPMailer->Send())
                return true;
            else
                return false;

        }

Snippet from php file that sends the email,

    $mailHandler = MailHandler::getInstance();

    $HTMLMessage = "

        <html>
        <body>

            <p>

                Hello Jack,

                We are so happy you have took your first step with us and welcome you to Network Your Fortune. We hope you are excited at our systems potential for all
                our memebers.

                Click the link below to get direct access to our website where you will find how you can join our free rota today!

                <a href='http://networkyourfortune.co.uk/rotainfo/'>Click Here To See And Join Our Rota!</a>

            </p>

        </body>
        </html>

    ";

    $altMessage = "

        <html>
        <body>

            <p>

                Hello Jack,

                We are so happy you have took your first step with us and welcome you to Network Your Fortune. We hope you are excited at our systems potential for all
                our memebers.

                Click the link below to get direct access to our website where you will find how you can join our free rota today!

                Click Here To See And Join Our Rota!: http://networkyourfortune.co.uk/rotainfo/

            </p>

        </body>
        </html>

    ";

    if($mailHandler->sendEmail("web-drq5bn@mail-tester.com", "JACK RESPONSE REQUIRED: Add Yourself To Our Rota", $HTMLMessage, $altMessage))
        echo "Sent";
    else
        echo "Error while sending";

上面的代码部分生成一条消息并发送它。问题是它直接进入了我在两个不同电子邮件帐户上的垃圾邮件文件夹。

我通过 mail-tester.com 对我的消息进行了测试,请在此处查看结果

它使用 SpamAssassin,这是一个“开源反垃圾邮件平台”,并在大量电子邮件服务器中使用,作为垃圾邮件过滤的标准。关键结果如图所示,

在此处输入图像描述

它说,“HTML:包含 800-1200 字节单词的图像你应该在电子邮件中写更多的文字”。如果您根本没有文本而只有图像,则进行一些研究似乎会标记此错误。我有文字,没有图片!

它说,“HTML 和文本部分是不同的”。如果您有 HTML 链接并且您必须为 alt 版本删除它们,那么当然会有所不同,因此损失了 0.724 点!

它还说,“由没有 rDNS 的主机交付到内部网络”,我已经联系了我的虚拟专用服务器的托管服务提供商,他们已经验证反向 DNS 工作正常。

当您的任何一条消息都没有进入垃圾邮件时,这是最糟糕的感觉。有人可以请教这里哪里出了问题或谁出了问题。我非常感谢对我的问题的任何帮助。

4

0 回答 0