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

后端 未结 7 945
[愿得一人]
[愿得一人] 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:22

    Exim 4 requires that AUTH command only be sent after the client issued EHLO - attempts to authenticate without EHLO would be rejected. Some mailservers require that EHLO be issued twice. PHPMailer apparently fails to do so. If PHPMailer does not allow you to force EHLO initiation, you really should switch to SwiftMailer 4.

    0 讨论(0)
  • 2021-02-01 07:24

    This isn't on the code parter it's on the server side Contact your Server Manager or fix it from server if you own it If you use CPANEL/WHM GO TO WHM/SMTP RESTRICTIONS AND DISABLE IT

    0 讨论(0)
  • 2021-02-01 07:25

    strange issue that i solved by comment this line

    //$mail->IsSmtp();
    

    whit the last phpmailer version (5.2)

    0 讨论(0)
  • 2021-02-01 07:34

    Check if you have set restrict outgoing SMTP to only some system users (root, MTA, mailman...). That restriction may prevent the spammers, but will redirect outgoing SMTP connections to the local mail server.

    0 讨论(0)
  • 2021-02-01 07:36

    that the OpenSSL extension enabled and the directory languages with "br"? first checks the data.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题