4

I am hoping that someone can help me with an issue that i cam across while trying to trouble shoot. I have some code on my site that sends a daily email to me. the last time it ran was 12/1/17. THe only part not working is the code that sends the email, nothing is being reported in the PHP log but I never receive the email. I use gmail smtp and everything had been working properly for years. I turned on debug and the results have me stuck. Here is what I am seeing:

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

It seems that something is scrambling the resulting debug information? I get the same results with different browsers and in the command prompt. I cannot figure out why (i suspect it may be related to TLS), and I am not sure how I can read the results to see if there is an error or not.

Thank you in advance for any help. It would be greatly appreciated.

Here is the code that sends the email, nothing has changed except to add the debug option.

Thanks again

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 Answers0