Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GMail SMTP connect() failed #525

Closed
mitsus opened this issue Oct 13, 2015 · 3 comments
Closed

GMail SMTP connect() failed #525

mitsus opened this issue Oct 13, 2015 · 3 comments

Comments

@mitsus
Copy link

mitsus commented Oct 13, 2015

Hi all,
i'm try to send eamil using gmail with my raspberry Pi (it it into my Home Lan).
I try to use exactly this example https://github.com/PHPMailer/PHPMailer/blob/master/examples/gmail.phps, but i've these errors:

   # php -q test_gmail.php 
   Connection: opening to smtp.gmail.com:587, timeout=300, options=array (  &#039;ssl&#039; =&gt;   array (    &#039;verify_peer&#039; =&gt; false,    &#039;verify_peer_name&#039; =&gt; false,    &#039;allow_self_signed&#039; =&gt; true,  ),)<br>
   Connection: opened<br>
   SERVER -&gt; CLIENT: 220 smtp.gmail.com ESMTP uq5sm4060328wjc.3 - gsmtp<br>
   CLIENT -&gt; SERVER: EHLO mauNone<br>
   SERVER -&gt; CLIENT: 250-smtp.gmail.com at your service, [91.213.153.133]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-     CHUNKING250 SMTPUTF8<br>
   CLIENT -&gt; SERVER: STARTTLS<br>
   SERVER -&gt; CLIENT: 220 2.0.0 Ready to start TLS<br>
   CLIENT -&gt; SERVER: EHLO mauNone<br>
   SERVER -&gt; CLIENT: 250-smtp.gmail.com at your service, [91.213.153.133]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER  XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8<br>
   CLIENT -&gt; SERVER: AUTH LOGIN<br>
   SERVER -&gt; CLIENT: 334 VXNlcm5hbWU6<br>
   CLIENT -&gt; SERVER: bWl0c3VzZGV2QGdtYWlsLmNvbQ==<br>
   SERVER -&gt; CLIENT: 334 UGFzc3dvcmQ6<br>
   CLIENT -&gt; SERVER: OW1hZDltYXg5<br>
   SERVER -&gt; CLIENT: 534-5.7.14 &lt;https://accounts.google.com/ContinueSignIn?sarp=1&amp;scc=1&amp;plt=AKgnsbtHB534-5.7.14 8ji9BpiKRFNEvWjl8WaaMaJUOJrfa3PLsUT9r_mhnYWYuE_ryBHUfyiCIgZv1W2z45QaZB534-5.7.14 n5urMjr5r8Xbegf5zNbgtI2ShYag95Q0AxSfc_1rzHq0793eETS5jTbQA6YG8Skvc2I8Lu534-5.7.14 qdIkuzdjGZYaxTl10kXU08P0DUxvaEDtMCV6VXwf02_29LpN3g6O33WcHYQz0p7D8SvV3y534-5.7.14 GSZO9YztI7FHgS18R0lR5Vcw4xdw&gt; Please log in via your web browser and534-5.7.14 then try again.534-5.7.14  Learn more at534 5.7.14  https://support.google.com/mail/answer/78754 uq5sm4060328wjc.3 - gsmtp<br>
   SMTP ERROR: Password command failed: 534-5.7.14 &lt;https://accounts.google.com/ContinueSignIn?sarp=1&amp;scc=1&amp;plt=AKgnsbtHB534-5.7.14 8ji9BpiKRFNEvWjl8WaaMaJUOJrfa3PLsUT9r_mhnYWYuE_ryBHUfyiCIgZv1W2z45QaZB534-5.7.14 n5urMjr5r8Xbegf5zNbgtI2ShYag95Q0AxSfc_1rzHq0793eETS5jTbQA6YG8Skvc2I8Lu534-5.7.14 qdIkuzdjGZYaxTl10kXU08P0DUxvaEDtMCV6VXwf02_29LpN3g6O33WcHYQz0p7D8SvV3y534-5.7.14 GSZO9YztI7FHgS18R0lR5Vcw4xdw&gt; Please log in via your web browser and534-5.7.14 then try  again.534-5.7.14  Learn more at534 5.7.14  https://support.google.com/mail/answer/78754  uq5sm4060328wjc.3 - gsmtp<br>
   SMTP Error: Could not authenticate.<br>
   CLIENT -&gt; SERVER: QUIT<br>
   SERVER -&gt; CLIENT: 221 2.0.0 closing connection uq5sm4060328wjc.3 - gsmtp<br>
   Connection: closed<br>
   SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting<br>
   Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

So..i've read https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting, but i can not use oauth authentication, because my device (Raspberry pi) is into my LAN and i'm not able to specify to google an public host name.

My question is how can i solve the problem? I don't understand how other emails client as Thunderbird, Outlook, ecc can set correctly an gmail account without oauth authentication.

Thanks a lot and best Regards

@Synchro
Copy link
Member

Synchro commented Oct 13, 2015

So, like the troubleshooting guide says, enable access for 'less secure apps' in your gmail account. The same applies to other clients that do not support XOAUTH2. Apple Mail on OS X and iOS supports XOAUTH2 with gmail, but I don't know about others.

@Sathiesh
Copy link

Sathiesh commented Jun 5, 2017

Is it necessary to turn on the less secure apps of my gmail account? why I'm asking this means am trying to do send email in production.
I tried without turn on my less secure apps of my email account, I get error like below
SMTP ERROR: Password command failed: 534-5.7.14
SMTP Error: Could not authenticate.

@Synchro
Copy link
Member

Synchro commented Jun 5, 2017

Read the troubleshooting guide to help diagnose your problem. It's not necessary to enable less secure apps if you use XOAUTH2 authentication - look at the wiki for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants