Question

Wordpress Multisite email configuration

Posted January 29, 2020 213 views
ApacheWordPressEmail

Hello.

I’m having a problem configuring an email to use with a Wordpress form. The domain,lusagua.pt, is part of a Wordpress multisite. My settings are:

SMTPADDRESS=smtp.office365.com
SMTP
PORT=587
SMTPUSER=noreply@lusagua.pt
SMTP
PASS=**********
SMTP_DOMAIN=lusagua.pt

I’m getting the following error:

*“SMTP Error: Could not connect to SMTP host.”
This may also appear as SMTP connect() failed or Called Mail() without being connected in debug output. This is often reported as a PHPMailer problem, but it’s almost always down to local DNS failure, firewall blocking (for example as GoDaddy does) or another issue on your local network. It means that PHPMailer is unable to contact the SMTP server you have specified in the Host property, but doesn’t say exactly why. It can also be caused by not having the openssl extension loaded (See encryption notes below).
*

and

Connection: opening to ssl://smtp.office365.com:587, timeout=300, options=array (
)Connection failed. Error #2: streamsocketclient(): SSL operation failed with code 1. OpenSSL Error messages:
error:1408F10B:SSL routines:ssl3getrecord:wrong version number [/var/www/html/wp-includes/class-smtp.php line 298]Connection failed. Error #2: streamsocketclient(): Failed to enable crypto [/var/www/html/wp-includes/class-smtp.php line 298]Connection failed. Error #2: streamsocketclient(): unable to connect to ssl://smtp.office365.com:587 (Unknown error) [/var/www/html/wp-includes/class-smtp.php line 298]SMTP ERROR: Failed to connect to server: (0)SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Can you help me?

Thanks in advance,
Tiago

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello,

In case that you are using a firewall like UFW I would recommend trying to open port 587 for outgoing TCP traffic, you could do that with the following command:

sudo ufw deny out 587

Then test this again.

If this does not work then try using telnet to test if you can connect on port 587 to another server like portquiz.net:

telnet portquiz.net 587

Let me know how it goes!
Regards,
Bobby

Submit an Answer