Bobcares

How to fix Joomla ‘SMTP connect() failed’ error while sending mails

by | Sep 16, 2016

Joomla is a commonly used content-management software for websites. In Joomla, emails are used for various purposes such as contact form submissions or password resets.

Joomla ‘SMTP connect() failed‘ is a commonly encountered email error in Joomla, when users try to submit a contact form in the website. Email fails to send, showing up this error.

By default, Joomla uses the PHP mail function to send mails. The settings for PHP Mail can be changed from the Joomla administrator dashboard.

Login to Joomla as admin user and go to the section ‘System’ -> ‘Global Configuration’ -> ‘Server’. Under ‘Mail Settings’, you can see PHP Mail as the Mailer and its corresponding settings.

 

Default setting in Joomla - PHP mail function

Default setting in Joomla – PHP mail function

 

What causes error Joomla ‘SMTP connect() failed’

In many servers where PHP mail function is disabled as a server security measure to avoid spamming, this default Mailer will not work to send mails.

That’s when we configure SMTP as the Mailer. From the drop-down for Mailer, choose SMTP instead of PHP Mail:

 

Change PHP mail to SMTP mail function

Change PHP mail to SMTP mail

 

Even though SMTP mailer is chosen, if the corresponding settings for the SMTP server is not configured correctly, it will not send mails successfully from the server.

Attempts to send mails from the Joomla website via contact form or password reset forms would end up giving error “Error while sending the email. SMTP connect() failed.”

The error ‘Joomla SMTP connect() failed’ is often caused by incorrect filling of the field ‘SMTP Security’ in the ‘Mail Settings’.

SMTP connection can fail to establish due to a number of reasons:

  1. Wrong username and password given in SMTP authentication.
  2. SMTP port blocked in server firewalls.
  3. Mail server does not support SSL/TLS.
  4. Using 3rd party servers such as gmail or other insecure apps.
  5. Upgrades to Joomla or PHPMailer versions that have enhanced security features or bugs.

How to fix error Joomla ‘SMTP connect() failed’

Here, we’ll see how to set each of these settings properly to avoid email delivery errors from Joomla. 

In Joomla administrator panel, under ‘System’ -> ‘Global Configuration’ -> ‘Server’ -> ‘Mail Settings’, choose Mailer ‘SMTP’ and enter host, user name and password. Turn on SMTP authentication section.

 

SMTP configuration settings for Joomla mail

SMTP configuration settings for Joomla mail

1. SMTP host and port settings

Enter the name of your mail server in ‘SMTP Host’ section. This is usually the ‘domain name’ or ‘mail.domain.com’. Make sure that the DNS for SMTP host resolves correctly.

Give port number as 25, the default SMTP port. For mail servers that use custom ports such as 587 for SMTP to avoid spamming, give that port.

It is also possible that certain mail servers restrict the access to their port 25 using firewall rules. In such cases, your IP should be white-listed in the firewall to avoid SMTP connect error.

To confirm that the connectivity to SMTP server and port is working fine, use the command:

telnet domain.com 25

Use the appropriate hostname and port number, after confirming that the SMTP connection is working fine. If the connectivity fails to establish, mail delivery will fail with the error ‘SMTP connect() failed‘.

2. SMTP authentication details

Every mail server has an authentication system to validate the users before allowing them to connect to it and send mails. In your Joomla Mail settings, turn this ON (YES).

Give the email account username and password. Enter the full ‘user@domain.com’ as the username in case of non-default accounts.

Whenever the email account password is changed or updated for security reasons, do not forget to change the password in ‘Mail settings’ also.

If the authentication details given are wrong, Joomla will fail to send mails and give the error ‘SMTP connect() failed‘.

3. SMTP security settings

For secure email transmission, it is always advisable to choose SMTP with SSL/TLS protocol. So, choose ‘SSL/TLS’ option from the drop-down for ‘SMTP Security’.

But is some email servers, this SSL/TLS support may not be enabled. In those cases, if you choose ‘SSL/TLS’ security, mails may not get delivered.

To verify the SSL certificate for your mail server, use the command:

openssl s_client -starttls smtp -crlf -connect mail.domain.com:25

Using expired or self-signed certificates can cause the mail delivery using SSL to fail and give error ‘SMTP connect() failed‘.

So the solution in those cases is to configure SSL for your mail server properly or change the SMTP Security settings from ‘SSL/TLS’ to ‘None’, which is less secure one.

 

Change Server Security from SSL/TLS to None

Change Server Security from SSL/TLS to None

 

4. Support for 3rd party apps

If you are using gmail email server instead of your own mail server, then there are a few points to note. You have to enable the ‘Authentication – GMail’ plugin.

You can do this from the Admin Area: ‘Extensions -> Plugin Manager -> Authentication – GMail’ option.

Also, Gmail servers may not accept connection attempts from certain mail client apps such as mobile apps. In those cases, either use a secure app or loosen the security measures.

In ‘My Account’ -> ‘Less Secure Apps’ section, turn on the option ‘Access for less secure apps’ to loosen the security settings.

This will avoid Joomla ‘SMTP connect failed’ errors when trying to send emails from Joomla using Gmail.

In short..

Other variants for ‘SMTP connect() failed’ error are ‘Called Mail() without being connected’ or ‘SMTP Error: Could not connect to SMTP host.’

In addition to the configuration settings we’ve discussed, one important point to keep in mind is the safety precautions to take during Joomla or PHPMailer upgrades.

Since new versions may often come with features or bugs that may break a working website, its always important to take proper backups and do test installs, before upgrading in the production server.

At Bobcares, our hands-on experience with both Joomla customization and server administration has helped us to perform upgrades and fixes in websites without causing any business downtime.

Read: Joomla customization with Bobcares

If you’d like to know how to secure and manage your servers and customize your websites to prevent errors, we’d be happy to talk to you.

 

Get a FREE 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!

TALK TO AN EXPERT NOW!


var google_conversion_label = "Blp0CLCojHIQ0aD71QM";

Bobcares provides Outsourced Hosting Support and Outsourced Server Management for online businesses. Our services include Hosting Support Services, server support, help desk support, live chat support and phone support.

9 Comments

  1. Larry

    Hi,
    I have failed to get this to work with Joomla 3.6xx. I have done some research and I found others are having same issues. I have tried various things and performed every step you have listed for Gmail without success. Could you please help me?

    Reply
    • Reeshma

      Larry,

      The issue could be due to some setting of SSL or mail server security feature. Only after checking the server for any mail delivery or connectivity issues with the gmail server, can we pinpoint the issue, if the other settings are fine. Please feel free to contact our 24/7 support team here – https://bobcares.com/contact-us/ – for a detailed investigation and further assistance.

      Reply
    • Reeshma Mathews

      Hi Emma,

      We would need to cross-check your SMTP settings and mail server to figure out why the error happens for you. Feel free to contact our 24/7 support experts here – https://bobcares.com/contact-us/ – for a detailed investigation and further assistance.

      Reply
  2. Sarah

    I have follow the step and filled in all the details, but i get Joomla ‘SMTP connect() failed‘.

    What should i do.?

    Reply
    • Visakh S

      Hi Sarah,

      We can help you with that. Click here to talk to our Joomla expert. We are online 24/7.

      Reply
  3. Pat

    i got this too in joomla 3.8.11

    SMTP connect() failed‘.

    but this is only by use the test button, the fornailer on the page works perfect i think this is joomla internal core problem !?

    Reply
  4. David Sodders

    Hi, the test email from the backend for me works fine but when I try to send an email from the form (default theme/setup) I get Notice
    SMTP Error! Could not authenticate. Any suggestions?

    Reply
    • Maheen Aboobakkar

      Hello David,

      This error happens when the SMTP authentication credentials are misconfigured/invalid. If you still face the issue, We’ll be happy to talk to you on chat (click on the icon at right-bottom).

      Reply

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.