Pear Mail Factory Debugging Problem

I hope someone can help me with the problem that I am encountering while trying to solve the problem. I have a code on my website that sends me a daily email address. the last time it was 12/1/17. The only part that doesn't work is the code that sends the email, nothing is reported in the PHP log, but I never get the email. I use gmail smtp and everything worked correctly for many years. I turned on debug and the results made me stuck. Here is what I see:

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);
}
+4

Source: https://habr.com/ru/post/1690905/


All Articles