PHPMailer could not connect to SMTP host

Is SMTP set up on ? And if so is it configured to listen to smtp..com on port 587? If the server is not set up by yourself it's not uncommon that they listen to mail..com instead. Also, try to connect to port 25 to see if it might be configured to listen to the default smtp port.

The error messages is in any case very clear. The host is not responding to your connection attempt. The reason could be missconfigurations in both the server and in PHP, firewall issues, routing issues, DNS issues etc.


Hopefully this helps someone else out there because I was fighting this same error. First I was getting. I was getting an error that said it couldn't connect(). Then I turned on the debugging and got the error you mentioned. The solution that worked for me was to change the smtp..com to the ip address.

$mail->Host = 'smtp.whateverDomain.com';

to

$mail->Host = 'theIPaddress';

debugging

$mail->SMTPDebug  = 1; // enables SMTP debug information (for testing)
                           // 1 = errors and messages
                           // 2 = messages only

I had this problem a while ago, everything checked out just fine but the problem persisted. A reboot of httpd.service solved it.