Take your e-commerce store further.

Using the right Magento 2 extension is more essential now than ever. With MagePal, you can rest assured that you are getting the best quality Magento extensions, each line of code are carefully crafted and rigorously tested. Spend less time debugging and more time doing what you do best with MagePal extensions!

SMTP Configurations

Reduce sending emails to your customers' junk mail folder with our SMTP extension!

Gmail / Google Business

Configurations

Office 365 / Outlook

Configurations

AWS / Amazon SES

Configurations

Total Downloads Latest Stable Version GitHub stars GitHub forks

Configuring SMTP Magento

What is SMTP for Magento?

Simple Mail Transfer Protocol (SMTP) allows your Magento 2 store to send email through a specific third-party mail SMTP server. You can configure your Magento store to use your Gmail, Amazon, Microsoft or any other mail server account to send all your emails. All you need is to configure the mail server settings in our Magento extension.

Extension Support

Like all other open source projects, sometimes things work and sometimes they don't for one reason or another.

We receive multiple emails & support tickets almost daily asking for help and we would love to help but in most cases, these issues have nothing to do with our extension and mostly caused by lack of basic Magento knowledge.

At MagePal our main focus is designing great Magento Extension and due to our limited resources, we simply can not provide free support for a free product.

Our affordable technical support include help with installation, usage, configuration, and troubleshooting for our Free Community Edition extensions.

Installation Guide

Need Help? Purchase Support

Step 1

composer require magepal/magento2-gmailsmtpapp
  • Download the extension
  • Unzip the file
  • Create a folder {Magento 2 root}/app/code/MagePal/GmailSmtpApp
  • Copy the content from the unzip folder

Step 2 - Enable Custom SMTP (“cd” to {Magento root} folder)

  php -f bin/magento module:enable --clear-static-content MagePal_GmailSmtpApp
  php -f bin/magento setup:upgrade

Google Tag Manager

Step 3 - How to Configure Magento SMTP

Log into your Magento 2 Admin

  1. Goto Stores
  2. Configuration
  3. MagePal
  4. SMTP Configuration
  5. Configure your SMTP setting

Step 4 - Extension Review

Like our extensions? Would you be kind enough to leave us a Google review? It only takes a minute and we’d be eternally grateful! Just click the link to go to our MagePal Google Business page and leave us your feedback.

SMTP Configuration Settings

Supported SMTP Providers

Integrate Magento 2 with virtually any SMTP provider, quickly and easily!

  • Gmail
  • Google App
  • G Suite
  • GoDaddy
  • Amazon Simple Email Service (SES)
  • Microsoft Office365
  • Outlook
  • SparkPost
  • Mandrill
  • MailGun
  • SendGrid
  • Elastic Email
  • Hotmail
  • AOL Mail
  • Yahoo Mail
  • AT&T
  • Verizon
  • Postmark
  • O2 Mail
  • Zoho
  • Mailjet
  • Mail.com
  • Your Company SMTP Server
  • and many other SMTP servers

How to update to the latest version

Step 1

composer update magepal/magento2-gmailsmtpapp
  • Download the latest version of our extension
  • Unzip the file
  • Create a folder {Magento 2 root}/app/code/MagePal/GmailSmtpApp
  • Copy the content from the unzip folder

Step 2 - Enable Custom SMTP (“cd” to {Magento root} folder)

  php -f bin/magento setup:upgrade

SMTP Debugging & Troubleshooting - Magento

Regardless of the problem you’re having, first check to sure you are using the latest version of our SMTP extension. When debug SMTP issues they are several point of failure and understanding the error message is key to quickly figure out your issue.

Common point of failure

  • Web server not configure correctly - Symptoms normally include onscreen error message, blank screen, error messages logged in apache log files.
  • Application error - Symptoms normally include onscreen error message, blank screen, error messages logged in apache error log and/or Magento var log.
  • Firewall Issues / DNS failures - Symptoms normally include long delay and/or timeout because connection is block by server.
  • Remote SMTP Provider error - Your application/web server is configure correctly, however your setting is not correct. Symptoms normally include service specific errors message (e.g. invalid username and password)

Authentication required

Authentication required (repo.magento.com)
   Username:

You will need to log into Magento Marketplace to get your authentication keys

Web Server Configuration Test

SMTP uses PHP mail, so the first thing you need to test is if php Mail is installed. Log into your server by ssh and run the command below.

Test if php mail is installed
php -r "mail('me@myEmail.com', 'Is PHP Mail Setup', 'Yes - I got this email');"
Expected Result

Blank line, no error

Possible Error Messages
sh: 1: /usr/sbin/sendmail: not found
Test if port is open
telnet smtp.gmail.com 465
Expected Result
Trying 173.194.204.109...
Connected to gmail-smtp-msa.l.google.com.
Connection refused

Connection refused normally means that something is blocked, so you should check with your hosting company or documentation to see if there is any special instruction to sending email in their infrastructure. E.g. GoDaddy blocks outbound SMTP, to all Host once it is not one of GoDaddy’s servers.

Possible Error Messages
Trying 173.194.192.109...
telnet: connect to address 173.194.192.109: Connection timed out

DNS Failures

These are often seen as connection timeouts, or “Temporary failure in name resolution”, “could not resolve host”, “getaddrinfo failed” or similar errors.

dig +short smtp.gmail.com
Expected Result
gmail-smtp-msa.l.google.com.
173.194.67.108

If this fails, our SMTP extension or not other SMTP extension will be able to send email because it won’t be able to obtain the correct IP address to connect to. You could try to use the direct IP address of the hostname you are trying to connect to. To fix this you need to figure out why your DNS is not resolving.

If dig is not configure on your server you could try

ping smtp.gmail.com
Firewall redirection

Another thing to make sure that the name the mail server responds with should be related to the server you requested, as you can see in the above example - we use telnet to connect to smtp.gmail.com and got gmail-smtp-msa.l.google.com, which is redirecting internally by google - but this could as easily be done by either your hosting provider or ISP which is often the case for port 25. This would mean that your your ISP’s or hosting provider firewall is redirecting you transparently to their own mail servers, and you’re likely to see authentication and TLS certificate verification failures issues.

SELinux blocking

If you are getting error message like SMTP -> ERROR: Failed to connect to server: Permission denied (13), Permission denied, and your are hosting on RedHat / Fedora / Centos this is more than likely cause by SELinux preventing PHP or the web server from sending email. . Using the getsebool command we can check if the httpd daemon is allowed to make a connection over the network and send an email:

getsebool httpd_can_sendmail
getsebool httpd_can_network_connect

This command will return a boolean on or off. If it’s off, we can turn it on:

sudo setsebool -P httpd_can_sendmail 1
sudo setsebool -P httpd_can_network_connect 1

If you’re running PHP-FPM via fastcgi, you may need to apply this to the fpm daemon rather than httpd.

Authentication failures

There are several likely causes, if your authentication is failing:

  • You are using the wrong username and password
  • Your connection is silently redirecting to a differ server
  • Authentication without encryption (tls)
Gmail, OAuth2 and “Allow less secure apps”

As of December 2014, in order to better secure customer’s email account Google has implemented new authentication mechanism called XOAUTH2 based on OAuth2 specification for access to their various services, including Gmail. This change can break both SMTP and IMAP access to Gmail or G-suite, and you may receive various authentication failures (“5.7.14 Please log in via your web browser and then try again” or “Username and Password not accepted”) while testing your configuration from our extension. Included in the error message is a link to https://support.google.com/mail/bin/answer.py?answer=78754, which provide a list of possible causes, or https://support.google.com/mail/?p=BadCredentials, which for the most part does not provide enough information. Currently our smtp extension does not support OAuth2 which would take a lot more time to setup.

  • For security reasons Gmail does not like unexpected or unfamiliar clients connecting to gmail accounts, so you may require to log into your gmail account from a browser as mentioned in error output, or to visit the CAPTCHA page mentioned in their support doc.

  • Enabling “Allow less secure apps” will usually solve the problem for our extension, since our recommendation is to use a dedicated email address to send mail it will not make your app significantly less secure. Please note that sometime changing this setting may take an hour or more to take effect.

“Could not instantiate mail function”

This error normally means that your PHP installation is not configured to send mail using the mail() function correctly. The most likely cause is this issue are sendmail_path is not set correctly in your php.ini or there is not local mail server installed and configured to send mail. (see Test if php mail is installed)

Self-signed SSL certificates

Currently our extension does not support Self-signed SSL certificates or other less know type of certificate. It normally cheaper to purchase a valid ssl vs the amount of work that will be require to make some certification work with SMTP. Possible solution see https://github.com/magepal/magento2-gmail-smtp-app/issues/30#issuecomment-262467780

If your are still having SMTP issues…

If all or any of the above setting or server is not correctly configured, our SMTP extension or any other SMTP extension will not send emails with Magento2, and usually there’s nothing our extension can do about it and you only solution is first fix your network, then try again.

If you are using a third party manage hosting provide and do not have control of your own firewall or DNS, you more than likely need to create a support ticket with your ISP to change your server configuration and to fix this issue (it’s very common for them to block or divert port 25 outbound and other ports by default). If they won’t fix it or can not figure it out then you may need to change your ISP.

Related Extensions

Get more from your Magento2 store!

Order Shipment Tracking

Providing your customer with a beautiful and functional order package tracking without leaving your site.

Magento Enhanced E-commerce

If your are using Magento + Google Analytics, then you need Enhanced E-commerce for Google Tag Manager.

Enhanced Success Page

Add cross-sell, upsell, related products, social media links and other elements to your order confirmation.

0

Total Downloads

11

years experience with Magento

30+

Magento / Adobe Commerce Extensions

Shop with confidence

With millions of downloads worldwide, install with confidence knowing that our extensions will just work.

Prepare for the future with Google Analytics 4

Is your Magento store ready for the future? Say hello to the new Google Analytics 4, which is built from the ground up with all-new features and advanced machine learning technology.

Learn More