SMTP Error: Could not connect to SMTP host

Error message/code:

SMTP Error: Could not connect to SMTP host

Description:

Script can't connect to SMTP server

Solution:

1. Make sure SMTP credential are correct.

2. If you on Linux check to see if SELinux is preventing the connection

[root@webserver ~]# sestatus -b | grep sendmail

If the result is httpd_can_sendmail off ... SELinux is preventing the connection. Allow it by:

setsebool httpd_can_sendmail=1

...and check again to make sure the change was applied:

[root@webserver ~]# sestatus -b | grep sendmail

The result should be

httpd_can_sendmail on

Restart Apache



Article ID: 338
Last updated: 25 Apr, 2012
Revision: 1
Error codes, messages -> SMTP Error: Could not connect to SMTP host
https://www.kbpublisher.com/kb/smtp-error-could-not-connect-to-smtp-host_338.html