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

Magento 2 SMTP Configuration Settings

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.

Version History | Change Log

3.0.6

  • New Features:
    • Add support for Magento 2.4.9

3.0.5

  • Fixed bugs:
    • Add support for Magento 2.4.8-p4

3.0.4

  • Fixed bugs:
    • Fix the incorrect Reply-To header class mapping

3.0.3

  • Fixed bugs:
    • Fix sender and Reply-To headers; add support for Magento 2.4.8-p3

3.0.2

  • New Features:
    • Add support for STARTTLS providers
  • Fixed bugs:
    • Allow all Magento 2.4.8 patch releases
    • Allow Magento 2.4.8-p2

3.0.1

  • New Features:
    • Add support for Magento 2.4.8-p1

3.0.0

  • New Features:
    • Add support for Magento 2.4.8 and PHP 8.4

2.9.3

  • New Features:
    • Add support for Magento 2.4.8 and PHP 8.4
    • Update company URLs to use HTTPS

2.9.2

  • New Features:
    • Add support for PHP 8.3
    • Add support for Magento 2.4.6 and PHP 8.2

2.9.1

  • New Features:
    • Add support for Magento 2.4.6 and PHP 8.2

2.9.0

  • New Features:
    • Add support for Magento 2.4.4

2.8.7

  • New Features:
    • Pre-release to better support 2.4.4

2.8.6

  • New Features:
    • Don’t activate by default

2.8.5

  • New Features:
    • Add support for Magento 2.4.0

2.8.3

  • New Features:
    • Ability to configure per environment

2.8.0

  • Fixed bugs:
    • Fix encoding issue in Magento 2.2.8+

2.7.1

  • Fixed bugs:
    • Fix email encoding issues
    • Fix invalid header values, fixes #160
    • Correct a class name

2.7.0

  • New Features:
    • Set utf8-encoding for To-address
    • Set UTF-8 encoding for the To address
    • Set header encoding to UTF-8
  • Fixed bugs:
    • Correct the ACL key in the controller and define it as a constant
    • Fix invalid header values

2.6.8

  • Fixed bugs:
    • Fix Amazon SES compatibility on Magento 2.2.10

2.6.7

  • Fixed bugs:
    • Fix email delivery through Amazon SES (issue #153)

2.6.6

  • New Features:
    • Add support for PHP 7.3
    • Allow PHP 7.3 in the Composer requirements

2.6.5

  • Fixed bugs:
    • Add Magento 2.3.3 support (issue #149)
    • Fix email delivery through Office 365

2.6.4

  • New Features:
    • Improve Office 365 support
  • Fixed bugs:
    • Issues 146 - Email object type

2.6.3

  • Fixed bugs:
    • Fix an invalid argument error (issue #141)
    • Fix a class-name typo on Magento 2.3.x
    • Issues #136 - admin 404 page

2.6.2

  • New Features:
    • Add Composer compatibility with Magento 2.3.x
  • Fixed bugs:
    • Fix Magento dependency requirements

2.6.1

  • New Features:
    • Add support for Magento 2.3 and PHP 7.2
  • Fixed bugs:
    • Issues #131 - Undefined method
    • Fix the undefined clearFrom() method

2.6.0

  • Fixed bugs:
    • Add compatibility with Magento 2.3.0 (issue #125)

2.5.6

  • New Features:
    • Magento 2.3 compatibility

2.5.5

  • Fixed bugs:
    • Issue #123 - Testing with config lock

2.5.0

  • Fixed bugs:
    • Issues #71 - Improve testing functionality

2.0.1

  • New Features:
    • Add html email template
    • SetDate if null on Zend_Mail
  • Fixed bugs:
    • Issues #75 - Add better support for multi-store

1.5.1

  • Fixed bugs:
    • Fix Composer dependency requirements for Magento 2.2

1.4.6

  • New Features:
    • Add support for Magento 2.2 and PHP 7.1
    • Add additional installation instructions

1.4.5

  • New Features:
    • Enable/disable module from admin

1.4.1

  • New Features:
    • Manual set-from should work now
    • Add helper function to get value of set_from
    • Implement actual logic to set From address (still need getConfigSetFrom method)
    • Add field to set ‘From’ value to pre-defined Return path.
    • Add support for SMTP without authentication

1.4.0

  • New Features:
    • Add support for client hostnames and the “None” authentication method
    • Allow email delivery without SSL
    • Local client name added

1.3.0

  • New Features:
    • Add smtp port option
  • Fixed bugs:
    • Issues #19 - Add smtp port option for testing

1.2.0

  • New Features:
    • Add support for Magento 2.1

1.1.0

  • Fixed bugs:
    • Add support for Reply-To and Return-Path (issue #8)
  • New Features:
    • Add support for other SMTP services

1.0.4

  • Fixed bugs:
    • Issue #6 - Fix dependency-injection compilation errors
    • Update the installation instructions (issue #4)
    • Fix Composer autoloading

1.0.3

  • New Features:
    • Add account verification
    • Use SSL by default
  • Fixed bugs:
    • Fix a bug that prevented transactional email delivery
    • Fix the “failed to open stream” error (issue #2)

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.

DataLayer for Tag Manager

Whether you are integrating Bing, Facebook, SnapChat, Pinterest, or any other services our extension make it easy.

HTML Minifier for Magento2

Minification is the process of removing all unnecessary characters and spacing from your source code without changing its functionality.

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