梨邮件工厂调试问题

时间:2017-12-16 18:15:42

标签: php pear pear-mail

我希望有人可以帮助我解决我在尝试解决问题时遇到的问题。我的网站上有一些代码,每天都会向我发送电子邮件。它的最后一次运行是12/1/17。只有部分不起作用的是发送电子邮件的代码,PHP日志中没有报告任何内容,但我从未收到过该电子邮件。我使用gmail smtp,一切都运行正常多年。我打开调试,结果让我卡住了。这就是我所看到的:

DEBUG: Recv: 220 smtp.gmail.com ESMTP f67sm17798350pff.173 - gsmtp
DEBUG: Send: EHLO localhost
DEBUG: Recv: 250-smtp.gmail.com at your service, [xxx.xxx.xxx.xxx]
DEBUG: Recv: 250-SIZE 35882577
DEBUG: Recv: 250-8BITMIME
DEBUG: Recv: 250-STARTTLS
DEBUG: Recv: 250-ENHANCEDSTATUSCODES
DEBUG: Recv: 250-PIPELINING
DEBUG: Recv: 250-CHUNKING
DEBUG: Recv: 250 SMTPUTF8
DEBUG: Send: STARTTLS
DEBUG: Recv: 220 2.0.0 Ready to start TLS
DEBUG: Send: RSET
DEBUG: Recv: MIA+!&w����]];�ʻ��.~���]�v��J�MJk��+��s�������z��?|?�qI�s'Y>H���LO����~����O�J��ˆ�F�0��UM�߇�"Z�6ד�FL��J� ����vx�g�����L�����}���F���~����Чg���ek�7�4�    z^�"��<��dP[p�`W~����^=bG���=�U�K�1+1؆�����;p"W�WE�3���P���F��Ԛ/D�TD܃�ʡ����â�d"�3!��ّ   3���U�,&r�X�@���.�@,��z��M�
DEBUG: Send: QUIT

似乎某些东西正在扰乱生成的调试信息?我在不同的浏览器和命令提示符下得到相同的结果。我无法弄清楚为什么(我怀疑它可能与TLS有关),我不知道如何阅读结果以查看是否存在错误。

提前感谢您的帮助。非常感谢。

以下是发送电子邮件的代码,除了添加调试选项之外没有任何更改。

再次感谢

function send_email ($email, $subject, $body, $from) 
{
//Send an email to the user with thier password information
//Pear Mail information for mime
require_once "Mail.php";
require_once "Mail\mime.php";
//Send to and subject headers
$from = $from;
$to = $email;
    //Pear mail information to send message
$mime = new Mail_mime();
$mime->setHTMLbody($body);
$body = $mime->get();
$headers = array(
        'From' => $from,
        'To' => $to,
        'Subject' => $subject);
$headers = $mime->headers($headers);
$smtp = Mail::factory('smtp', array(
        'host' => EMAIL_HOST,
        'auth' => true,
        'username' => EMAIL_USERNAME,
        'password' => EMAIL_PASSWORD,
        'port' => EMAIL_PORT,
        'debug' => true));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
        $result = (''.$mail->getMessage().'');
    } else {
        $result = ("Message successfully sent! \r\n.  Email was sent to $to \r\n");
    }
return ($result);
}

0 个答案:

没有答案