How to fix email error ‘SMTP connect() failed’ in WordPress sites

How to fix email error ‘SMTP connect() failed’ in WordPress sites

WordPress is the most widely used CMS for websites. Sending out mails from WordPress is required in scenarios such as contact form submissions or password resets.

‘SMTP connect() failed‘ is a commonly encountered error in WordPress, due to which emails fail to be send from your WordPress site.

Configuring email settings in WordPress

By Default, WordPress uses the PHP Mail function to send emails. But using PHP mail function is a less secure method and makes the server vulnerable to spamming.

As a result, many webservers have PHP mail() function disabled for security purposes. In those servers, mails can be send from WordPress using SMTP.

SMTP uses proper authentication and is therefore more secure. There are WordPress plugins such as ‘WP Mail SMTP‘, that has to be configured to send mails via SMTP.

Once the SMTP plugin is activated, a new ‘Email‘ menu will show up under the Settings in WP. You can configure the email delivery settings in that option.


Configure SMTP plugin in WordPress

Configure SMTP plugin in WordPress

You can give your email address, password, mail server name and port in the Email settings and save it. You can test the mail delivery to see if the settings are fine.

The following settings can be configured in the Email settings:

From Email - the email address you want to send emails from 
From Name - the name that your emails will be received from
Mailer - you can choose between the default PHP Mail function and SMTP
SMTP Host - the hostname for your SMTP server
SMTP Port - the port for your mail server, usually 25
Encryption - if you want to enable SSL/TLS encryption for the mail server
Authentication - check it for mail server authentication
Username - the username for your SMTP server
Password - the password for your SMTP server

What causes error ‘SMTP connect() failed’ in WordPress

The default mailer is PHPMailer in WordPress and many sites use it to send mails. But it can give ‘SMTP connect() failed’ error if PHPMailer is unable to contact the SMTP server.


SMTP connect() failed error in WordPress

SMTP connect() failed error in WordPress


Also, if the settings for the SMTP server is not configured correctly, it will not send mails successfully from the server and give ‘SMTP connect() failed’ error.

The error ‘SMTP connect() failed’ can be caused due to the many reasons, which we’ll discuss one by one.

Wrong username and password given in SMTP authentication.

SMTP port blocked in mail server firewalls.

SSL/TLS not support in mail server and encryption is enabled in WP setting.

Security restrictions by 3rd party servers such as gmail or email apps.

Upgrades to WordPress plugin or PHPMailer versions that have enhanced security features or bugs.

Get an EXPERT consultation

Do you spend all day answering technical support queries?

Wish you had more time to focus on your business? Let us help you.

We free up your time by taking care of your customers and servers. Our engineers monitor your servers 24/7, and support your customers over help desk, live chat and phone.

Talk to our technical support specialist today to know how we can keep your service top notch!



  1. what if we only use php code without plugin wordpress? it is still possible to smtp connect? please help

    • Venator,

      It is possible to send mails via smtp function using PHP scripts too. Please submit your details at and we would help you configure the mail delivery settings of your PHP script.

  2. I face the same issue, the mail is not send. What i have to do,


Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.

Privacy Preference Center


    Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

    PHPSESSID - Preserves user session state across page requests.

    gdpr[consent_types] - Used to store user consents.

    gdpr[allowed_cookies] - Used to store user allowed cookies.

    PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]


    Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

    _ga - Preserves user session state across page requests.

    _gat - Used by Google Analytics to throttle request rate

    _gid - Registers a unique ID that is used to generate statistical data on how you use the website.

    smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

    _ga, _gat, _gid
    _ga, _gat, _gid


    Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

    IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

    test_cookie - Used to check if the user's browser supports cookies.

    1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

    NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

    DV - Google ad personalisation

    IDE, test_cookie, 1P_JAR, NID, DV, NID
    IDE, test_cookie
    1P_JAR, NID, DV