25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

How to fix “SMTP Error: Could not connect to SMTP host.”

by | Oct 19, 2018

Emails play a crucial role in online businesses. It can be bothersome when emails stop working. You may lose an urgent invite or important notification.

As part of our Support Services, we help website owners configure email services for their businesses and assist server owners to fix email errors.

One such commonly encountered error is “SMTP Error: Could not connect to SMTP host.” Today we’ll see what causes that error and how we fix it.

“Unable to connect to SMTP host.” – When do you see this error?

Majority of the SMB websites run on CMS such as WordPress, Joomla, WHMCS, etc. Most of these CMS software are configured to send emails from them.

These emails can be sent for various purposes – such as order confirmations, invoice delivery, contact form submissions, password resets, account registration and so on.

But due to any issues related to email server or configuration, this mail delivery can fail and give out the error “SMTP Error: Could not connect to SMTP host.”

The same error can present in different forms, such as:

SMTP -> ERROR: Failed to connect to server: (0)

SMTP Error: Could not connect to SMTP host. Message could not be sent.

Mailer Error: SMTP Error: Could not connect to SMTP host.

‘SMTP connect() failed’

What causes the email error “Unable to connect to SMTP host”

A number of reasons can lead to the SMTP connection error. That’s what often perplex the website owners when they see this error.

Here are the main causes we’ve identified in our debugging process.

1. Security restrictions

Exim servers, by default, have some security restrictions to avoid outbound spamming and to protect server IP reputation from blacklists. These restrictions lead to SMTP errors.

The setting in WHM ‘Server Configuration > Tweak Settings > Mail => ‘Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)’, blocks outgoing SMTP from website software.

Exim security restrictions

 

Another setting in WHM that provides the same restriction is, “WHM Home » Security Center » SMTP Restrictions”. This prevents users from bypassing the mail server to send mail.

WHM – SMTP restriction

 

To further secure mail servers, most servers have firewalls such as CSF, configured in them. Firewall rules can be configured to selectively or fully block connectivity to the SMTP ports.

Many ISPs also block the default SMTP port (25), to avoid spamming attempts. SELinux restriction is another security feature that can cause connection issues to mail server.

Website owners who use gmail as their SMTP server would face further security restrictions imposed by Google. By default, gmail does not allow connections from third party software.

If the option “access for less secure apps” is not enabled in the gmail account, users get the error “Unable to connect to SMTP host” in their websites.

2. Mail server configuration

The SMTP server is often specified as a hostname in the mail settings of the software. A DNS failure or temporary issues can affect the name resolution of the mail server.

In such scenarios, the mailing software will not be able to contact the SMTP server, causing connection errors. If the mail server has another service running on the SMTP port configured, the same issue occurs.

Another issue related to mail server is the lack of support for encryption. If the OpenSSL module is not configured properly or if the PHP extension is not working fine, it will throw errors during SMTP connections.

3. Client side mail settings

To send mails from website software, you need to configure the settings such as SMTP host, port and mail account username and password.

Any configuration mistakes in these settings can cause email errors due to authentication failures and show the message “Unable to connect to SMTP host”.

If the connection is attempted to a different mail server, it will not work. This can happen especially in the cases of website migration from one server to another.

Also, when encryption is not chosen for mail settings, many mail servers can reject the connection attempt and show “Unable to connect to SMTP host” error.

4. Software errors

Many website owners customize their software with plugins that enable them to send mails. Many others have custom code and tweaks done in their CMS.

Due to software updates, feature modifications, plugin issue or other code related bugs, the SMTP authentication support can stop working, giving out SMTP errors in the site.

How we fix the email error “Unable to connect to SMTP host”

To fix the error, we first figure out the cause for it. We examine the software settings, test the connectivity to mail server, and other security restrictions in the server to pinpoint the issue.

Once the cause for the error is identified, we make appropriate fixes such as re-configuring firewall rules and tweaking the security settings, so that mail delivery works fine.

For software updates and installs, we take proper backups and conduct mock installs beforehand, which help us to perform upgrades and fixes in websites without causing any errors.

Conclusion

Email errors are the most commonly encountered issues in servers. Today we saw why “Unable to connect to SMTP host” error happens in websites and how our Support Engineers fix them.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

6 Comments

  1. John Rook

    I m having a persistent problem connecting to my smtp server on BOTH my MacBook Pro and my iPhone.

    I have spent several hours with my email service provider (ionos.co.uk) but they are confident that the problem of not accessing my smtp server is at my end, not theirs.

    I have tried deleting all references to my mail servers in the keychain. I have reinstalled and upgraded the OS to Big Sur. But neither of these has worked.

    I am at a loss as to what the problem is or where it lies.

    Reply
    • Maheen Aboobakkar

      Hello John,

      We’ll be happy to talk to you on chat (click on the icon at right-bottom).

      Reply
  2. S Naeem

    great I spent more than 3 days on reseaching SMTP error on youtube google.. I alomost visted all sites but my site ibrainhost.com was still facing same issue 🙁 thanks to bobcares who solved my biggest issue..

    Reply
    • Hiba Razak

      Hi,
      We are glad to know that our article helps you solves the issue. ?

      Reply
  3. Stuart Hillier

    The host ‘SMTP’ could not be found. Please verify that you have entered the server name correctly.

    Subject ‘Test’
    Server: ‘SMTP’
    Windows Live Mail Error ID: 0x800CCC0D
    Protocol: SMTP
    Port: 25
    Secure(SSL): Yes
    Socket Error: 11001

    Reply
    • Hiba Razak

      Hi,
      Our experts can help you with the issue.we will be happy to talk to you through our live chat(click on the icon at right-bottom).

      Reply

Submit a Comment

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

Privacy Preference Center

Necessary

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]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

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
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

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
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF