Fixing the 'SMTP connect() failed' Error in Easy WP SMTP: A Comprehensive Guide
Content
If you've encountered the frustrating SMTP ERROR: Failed to connect to server message while setting up the Easy WP SMTP plugin, you're not alone. This is one of the most common issues users face when configuring SMTP for their WordPress site. This guide will break down what this error means and walk you through the most effective troubleshooting steps.
What Does the "SMTP connect() failed" Error Mean?
This error is generated by the PHPMailer library, which the plugin uses to handle email sending. It indicates that your WordPress site was unable to establish a network connection to the SMTP mail server you specified (e.g., smtp.gmail.com, smtp.office365.com, or your host's server). The specific error code in parentheses provides a clue:
- (0), (110), Connection timed out: The server did not respond at all. Often a firewall, network, or DNS issue.
- (111), Connection refused: The server was found but actively rejected the connection. Usually a port blocking or authentication configuration issue.
- php_network_getaddresses: getaddrinfo failed: Name or service not known (0): The server hostname (e.g., smtp.gmail.com) could not be resolved to an IP address. This is typically a DNS or typo issue.
Most Common Causes and Solutions
1. Incorrect SMTP Settings
The most frequent cause is simply entering the wrong details for your email provider.
- Check and Double-Check: Ensure the SMTP host, port, encryption type (SSL/TLS), username, and password are exactly as provided by your email service. A single typo is enough to cause a failure.
- Gmail/Google Workspace: Host:
smtp.gmail.com, Port:587(TLS) or465(SSL), Authentication: ON. - Office 365/Outlook: Host:
smtp.office365.com, Port:587, Encryption: STARTTLS (often labeled TLS), Authentication: ON.
- Gmail/Google Workspace: Host:
- App Passwords: For Gmail accounts with 2-Factor Authentication (2FA) enabled, you cannot use your regular password. You must generate a unique App Password and use that in the SMTP password field.
- Less Secure Apps (Gmail): If you don't use 2FA, ensure "Less secure app access" is turned on in your Google Account settings. Note: Google is phasing out this option, so using an App Password is the recommended method.
2. Hosting Provider Restrictions
Many web hosts, including GoDaddy, Bluehost, and others, block outgoing SMTP connections to external mail servers on common ports (25, 465, 587) as a security measure. They often require you to use their SMTP servers instead.
- Contact Your Host: This is a critical step. Reach out to your hosting provider's support and ask: "Are outbound SMTP connections to ports 465 and 587 allowed to external mail servers like Gmail? If not, what are your recommended SMTP settings?"
- Use Host's SMTP: If they block external connections, you must use the SMTP server details provided by your host, not Gmail's or Office 365's.
3. Firewalls and Security Plugins
A firewall on your server or a security plugin on your WordPress site (e.g., Wordfence, Sucuri) could be blocking the outgoing connection.
- Temporarily disable any WordPress security plugins to test if they are the cause.
- Check your server's firewall rules (or contact your host to do this) to ensure outgoing traffic on your SMTP port is permitted.
4. Localhost and Development Environments
Sending email from a local server (like XAMPP or MAMP) is notoriously difficult because these environments are often not configured for SMTP and may be blocked by ISPs or email providers.
- Consider using a mail testing plugin or a service like Mailtrap for development instead of trying to configure a live SMTP connection.
5. Recent Changes
If the plugin was working and suddenly stopped, ask yourself what changed:
- Did your host change their firewall policies?
- Did your email provider (e.g., Google) update their security requirements?
- Did you update a plugin, theme, or WordPress core that might have caused a conflict?
- Did you revoke an App Password or change your email password?
Summary: Your Action Plan
- Verify Settings: Triple-check your SMTP settings against your email provider's documentation.
- Use App Passwords: For Gmail with 2FA, generate and use an App Password.
- Contact Your Host: This is the most crucial step for errors like
Connection timed out (110)andConnection refused (111). Inquire about SMTP restrictions. - Check for Conflicts: Temporarily disable other plugins to rule out conflicts.
Remember, the 'Easy WP SMTP – WordPress SMTP and Email Logs' plugin relies on your server's ability to connect to the mail server. The error message almost always points to a configuration, network, or hosting policy issue rather than a bug in the plugin itself. By methodically working through these steps, you can identify and resolve the connection problem.
Related Support Threads Support
-
Email Sending Errorhttps://wordpress.org/support/topic/email-sending-error-2/
-
Could not connect to SMTP hosthttps://wordpress.org/support/topic/could-not-connect-to-smtp-host-9/
-
SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo fhttps://wordpress.org/support/topic/smtp-error-failed-to-connect-to-server-php_network_getaddresses-getaddrinfo-f/
-
GMAIL SMTP Not workinghttps://wordpress.org/support/topic/gmail-smtp-not-working-3/
-
SMTP connect() failed.https://wordpress.org/support/topic/smtp-connect-failed-21/
-
SMTP connect() failedhttps://wordpress.org/support/topic/smtp-connect-failed-22/
-
SMTP -> ERROR: Failed to connect to server: Connection refused (111)https://wordpress.org/support/topic/smtp-error-failed-to-connect-to-server-connection-refused-111-2/
-
Stopped workinghttps://wordpress.org/support/topic/stopped-working-402/
-
Can’t send email via Gmailhttps://wordpress.org/support/topic/cant-send-email-via-gmail/
-
Server changed, now smtp errorhttps://wordpress.org/support/topic/server-changed-now-smtp-error/
-
SMTP ERROR: Failed to connect to server: Connection timed out (110)SMTP connect(https://wordpress.org/support/topic/smtp-error-failed-to-connect-to-server-connection-timed-out-110smtp-connect/
-
Не работаетhttps://wordpress.org/support/topic/%d0%bd%d0%b5-%d1%80%d0%b0%d0%b1%d0%be%d1%82%d0%b0%d0%b5%d1%82-104/
-
SMTP ERROR: Failed to connect to server: Connection timed out (110)SMTP connecthttps://wordpress.org/support/topic/smtp-error-failed-to-connect-to-server-connection-timed-out-110smtp-connect-4/
-
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshootihttps://wordpress.org/support/topic/smtp-connect-failed-https-github-com-phpmailer-phpmailer-wiki-troubleshooti/
-
Test emails not workinghttps://wordpress.org/support/topic/test-emails-not-working/
-
I get and error message when trying to test mail submissionhttps://wordpress.org/support/topic/i-get-and-error-message-when-trying-to-test-mail-submission/
-
SMTP ERROR: Failed to connect to server: (0)SMTP connect() failed. https://githhttps://wordpress.org/support/topic/smtp-error-failed-to-connect-to-server-0smtp-connect-failed-https-gith/
-
SMTP Setting Gmailhttps://wordpress.org/support/topic/smtp-setting-gmail/
-
No puedo enviar correo de Pruebahttps://wordpress.org/support/topic/no-puedo-enviar-correo-de-prueba/
-
Can’t connect from localhosthttps://wordpress.org/support/topic/cant-connect-from-localhost/
-
Not able to connecthttps://wordpress.org/support/topic/not-able-to-connect-5/
-
Problems with mail server connection.https://wordpress.org/support/topic/problems-with-mail-server-connection/
-
SMTP ERROR: Failed to connect to serverhttps://wordpress.org/support/topic/smtp-error-failed-to-connect-to-server-5/
-
Digital Ocean Hosting errorhttps://wordpress.org/support/topic/digital-ocean-hosting-error/
-
Help Office 365https://wordpress.org/support/topic/help-office-365/
-
Not receiving mailshttps://wordpress.org/support/topic/not-receiving-mails-6/
-
SMTP ERROR: Failed to connect to serverhttps://wordpress.org/support/topic/smtp-error-failed-to-connect-to-server-11/
-
SMTP DOESN’T WORK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!https://wordpress.org/support/topic/smtp-doesnt-work-2/
-
SMTP ERROR: Failed to connect to server:https://wordpress.org/support/topic/smtp-error-failed-to-connect-to-server-10/
-
SMTP ERROR via gmail on GoDaddy serverhttps://wordpress.org/support/topic/smtp-error-via-gmail-on-godaddy-serve/
-
SMTP ERROR: Failed to connect to server – with gmailhttps://wordpress.org/support/topic/smtp-error-failed-to-connect-to-server-with-gmail/
-
SMTP ERROR: Failed to connect to server: (0)SMTP Error: Could not connect to SMhttps://wordpress.org/support/topic/smtp-error-failed-to-connect-to-server-0smtp-error-could-not-connect-to-sm/
-
SMTP connect() failedhttps://wordpress.org/support/topic/smtp-connect-failed-25/