Most probably this seems to be a port block issue on your server.
In case you are on a shared hosting server, then most probably the ports 25, 465 and 587 are blocked. This block is been purposely done by your hosting provider. This is true even for some of the dedicated servers.
Most of the hosting providers block these email ports to protect their network from sending any spam emails.
There are two solutions to this problem:
1. Contact your hosting provider to unblock these ports.
2. If the port issue still persists, then you can try out a Port Free alternative- Pepipost WP Plugin (https://wordpress.org/plugins/pepipost/). This plugin uses API instead of SMTP protocol for sending emails.
Hope the information works!
I had a similar problem, not sure if its the same, but worth checking: On my server it was set up to block connecting to external smtp servers, that was the default setting in CSF (config server firewall) that is very common to use on servers with cpanel. So it was simple to fix once I thought about it, but you must be able to change the settings on the server to fix it.
I started thinking about it because it worked to connect to a local smtp server, but not the external one I needed to use. The server you are on probably have an smtp server you can use to test, you just need to set up an email acc you can use to connect.
-
This reply was modified 9 years, 3 months ago by
torsteino.
Hi @geniusdibya, thanks for your answerβ¦ I am working on a local environment (mac) β can you tell me where I can unlock this port exactly? Do I have to edit my httpd.conf?
Sooo: Putting the following snippet into my functions.php file, solved the issue for me:
// Allow for SMTP being used to send emails on localhost
function rah_phpmailer_workaround( $phpmailer ) {
$phpmailer->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
return $phpmailer;
}
add_filter('wp_mail_smtp_custom_options', 'rah_phpmailer_workaround');
@nonverbla Thanks for posting your solution.