By Tiago Simões
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:
SMTP_ADDRESS=smtp.office365.com SMTP_PORT=587 SMTP_USER=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: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:ssl3_get_record:wrong version number [/var/www/html/wp-includes/class-smtp.php line 298]Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [/var/www/html/wp-includes/class-smtp.php line 298]Connection failed. Error #2: stream_socket_client(): 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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.