Bobcares

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

Conclusion

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.

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";

0 Comments

Submit a Comment

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

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