0

Some of the times trying to send email through php web application I'm getting "smtp connection failed", and some other times it works perfectly without throwing any exceptions. The app is under the same configuration as always ( "smtp.gmail.com", port: 587, protocol: TLS ). I beleive that the error it's triggered by a timeout as the gmail server does not response. I've noticed this irregular behaviour since last week or so. Any clues?

This is the response with "SMTPDebug = 3" enabled:

2017-02-02 16:19:36 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ( ) 2017-02-02 16:20:18 SMTP ERROR: Failed to connect to server: Network is unreachable (101) 2017-02-02 16:20:18 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ( ) 2017-02-02 16:21:02 SMTP ERROR: Failed to connect to server: Network is unreachable (101)

I've also tried adding "tls://" to the host address smtp.gmail.com, as suggested in other tread with no success...

thanks in advance

xavii
  • 1
  • 3
  • Strangely enough, PHP code has very little potential to make your network go up and down, and correspondingly, changing your PHP code is unlikely to fix your network... In other words, fix your network. – Synchro Feb 02 '17 at 20:11
  • I'd check to see if you have a firewall blocking the outbound traffic. – Mike Mannakee Feb 02 '17 at 20:23
  • Possible duplicate of [SMTP GMAIL Connection](https://stackoverflow.com/questions/31058038/smtp-gmail-connection) – mario Nov 13 '18 at 11:57

0 Answers0