Phpmailer using smtp with Gmail not working - connection timing out

前端 未结 8 1993
天命终不由人
天命终不由人 2020-12-11 07:52

I\'ve looked into the following links:

phpmailer send gmail smtp timeout

send email using Gmail SMTP server through PHP Mailer

http://uly.me/phpmaile

8条回答
  •  难免孤独
    2020-12-11 08:07

    I had this same problem and solved it:

    First, turn on smtp error logging in phpmailer:

        $mail->SMTPDebug  = 2;       // enables SMTP debug information (for testing)
    

    Then retry your phpmailer email send. You will see the entire SMTP conversation on standard error output. If you're using a web server, look in the web server log file.

    I could then see the error response from gmail. Gmail was not accepting the login.

    The error within the smtp conversation refers to an article. It gives some tips:

    1. Allow less secure apps to use your account.
    2. Login to gmail from a web browser.
    3. Confirm the gmail login captcha. (It may not actually display a captcha to you, but this was the additional step that suddenly allowed my email to go through.)

提交回复
热议问题