Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

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

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

Drupal SMTP error “could not connect to smtp host”

by | Apr 28, 2021

Drupal users often receive the SMTP error “could not connect to smtp host” while sending mails from the site.

As a part of our Server Management Services, our Support Engineers helps to fix similar Drupal-related errors regularly.

Let us today discuss some of the possible reasons and fixes for this error.

What causes Drupal SMTP error “could not connect to smtp host”

Our Support Engineers often receive requests complaining that they are receiving the following error while sending emails from Drupal.

phpmailerException: SMTP Error: Could not connect to SMTP host

Some of the most common reasons for this error include:

  • Firewall restrictions
  • Email settings at the provider end
  • SMTP auth support settings

Let us now look at some of the possible solutions to fix this error.

How to fix Drupal SMTP error “could not connect to smtp host”

One of the first steps that our support engineers follow when they see the “could not connect to smtp host” error in Drupal is to enable the SMTP debug available on the SMTP configuration page.

Drupal SMTP error could not connect to smtp host

When we try to send mails with this option enabled, it gives us a more detailed story of why we can’t send the message.

SMTP auth support settings

As discussed earlier, a common reason for the error is the wrong SMTP settings. Our Support Engineers recently fixed this error where the issue was that the port settings were entered incorrectly.

So, it was clear that PHPMailer was unable to contact the SMTP server defined in the mail server settings.

Similarly, another customer reported that his emails did not work after configuring the SMTP module in Drupal.

Therefore, our Support Engineers checked the SMTP server settings in Drupal. Then, they found that the wrong SMTP server name setting caused the problem with emails.

So, we solved the issue by providing the correct SMTP server name and port settings in Drupal SMTP server settings.

Email settings at the provider end

At times, this error could be related to restrictions at the email provider end. Often, users find that GMail blocked them from sending mails. In this case, try moving to a dedicated SMTP transaction email server.

Sometimes users receive errors while using 25 ports for connection. Switching to 465  worked in such cases.

Often, users also require to enable “less secure apps” on the gmail/google apps account. Also, they have to set up the smtp relay in the google apps admin console from the Advanced Settings option


Firewall restriction

Our Engineers have noticed cases where the SMTP ports are blocked at the server firewall end. Thus we need to allow access for firewall or network to send mail for linux, windows and mac.

Following command set permission for Linux to allow ports 465 and 587.

1) iptables -I OUTPUT -p tcp –dport 465 -j ACCEPT
2) iptables -I OUTPUT -p tcp –dport 587 -j ACCEPT


In short the Drupal error triggers due to improper Drupal SMTP settings such as wrong SMTP server name, wrong port settings, etc. Today, we saw how our Support Engineers fixed related errors.


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.


var google_conversion_label = "owonCMyG5nEQ0aD71QM";


Submit a Comment

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

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


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.