Jump to content

[Solved] Can't Send Mail Via Php To Gmail With Ports 465 And/or 587


mlex

Recommended Posts

Hey folks, I have some troubles sending an email through PHP to gmail via PHPMailer and ports 465(ssl) and/or 587(tls).

 

Any chance you could open 465(preferably, I guess, because it's more secure) port, please?

 

Update 01: On other hand, it would be much wiser to use 587 port, due the fact that SSL on port 465 was deprecated long time ago(1998)

Link to comment
Share on other sites

This is weird, because I'm getting an error with connectivity:

 

SMTP ERROR: Failed to connect to server: Network is unreachable (101)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

 

 

My SMTP at gmail are open;

I've google it and found out from older posts at "https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting", that this is clearly(99%) a connectivity problem of the server.

 

Is it possible to test it via telnet smtp.gmail.com 587 , so we could be sure in if it's blocked on server level or not?

Link to comment
Share on other sites

Johnny -> Tommy

root@johnny [~]# nc tommy.heliohost.org 587
220-tommy.heliohost.org ESMTP Exim 4.87 #1 Tue, 11 Apr 2017 08:18:40 -0700
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
^C
Tommy -> Johnny

root@tommy [~]# nc johnny.heliohost.org 587
220-johnny.heliohost.org ESMTP Exim 4.88 #1 Tue, 11 Apr 2017 08:16:19 -0700
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
^C
Link to comment
Share on other sites

Not sure what you exactly meant by that, Krydos.

 

But I tried to google the output of the logs and found out the solution by commenting the following line:

$mail->isSMTP();

This is odd, because this actually should tell PHPMailer to use SMTP.

 

Did you actually meant by this:

220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.

 

I'm abusing(trying to) the system or something? Because this obviously not the case :)

Link to comment
Share on other sites

Glad to hear that, Krydos.

 

I actually found out that commenting the

$mail->isSMTP();

in PHPMailer isn't really solving the problem, because this actually tells PHPMailer to use default mail() function instead of SMTP.

 

This error (Failed to connect to server: Network is unreachable) with PHPMailer is very common at GoDaddy hosting and as far as I googled it, it's about hosting-related issues with the port or something on the server's end.

 

I could make a simple page for testing specifically this and give you a link to that with all the access you'll need, to observe the problem, perhaps this could help to figure out why is it through this error if the ports are open

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...