Problem with SMTP authentication in PHP using PHPMailer, with Pear Mail works

后端 未结 7 937
[愿得一人]
[愿得一人] 2021-02-01 06:58

I´m having trouble sending a e-mail with the PHPMailer class, but it works with PEAR Mail::factory.

I guess the problem is with the SMTP authentication, but I couldn´t f

7条回答
  •  醉梦人生
    2021-02-01 07:37

    Try adding this:

    $mail->SMTPAuth   = true;
    $mail->SMTPSecure = "tls";
    

    By looking at your debug logs, you can notice that the failing PhpMailer log shows this:

    (..snip..)
    SMTP -> ERROR: AUTH not accepted from server: 250 orion.bommtempo.net.br Hello admin-teste.bommtempo.com.br [200.155.129.6]
    (..snip..)
    503 AUTH command used when not advertised
    (..snip..)
    

    While your successful PEAR log shows this:

    DEBUG: Send: STARTTLS
    DEBUG: Recv: 220 TLS go ahead
    

    My guess is that explicitly asking PHPMailer to use TLS will put it on the right track.
    Also, make sure you're using the latest versin of PHPMailer.

提交回复
热议问题