Magento Tutorials

How to Configure SMTP Settings for Sending Emails in Magento

When you don’t want to use Magento default sendmail system, nor some third-party extension for sending emails, then you may want to manually set up external SMTP for your store. This guide will help you configure SMTP settings for outgoing emails in Magento.

In this tutorial, we’ll be using Mageplaza’s SMTP extension. The extension is free and easily configurable, and we highly recommend you use it for the sending of emails for your Magento store.

Installing SMTP extension

The recommended way is to install the extension via composer, as this way provides the best compatibility for your system.

In your Magento root folder, open terminal and run the following commands:

composer require mageplaza/module-smtp
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f

Configuring

After installing the extension, go to your Magento backend to start configuring the extension for your email sending needs.

In your Magento 2 backend, navigate to: 

Stores > Settings > Configuration > Mageplaza > SMTP

Enable SMTP

Enter your name and email address in order to activate the extension. After which, expand the General Configuration section and set Enable Mageplaza SMTP to Yes.

Enable Mageplaza SMTP

Next, expand SMTP Configuration Options:

SMTP Configuration Options

From here you can configure various essential settings, which is why you’ll want to make sure that you do everything right in the following steps:

Select SMTP provider

In the same SMTP Configuration Options, select a pre-defined SMTP provider by clicking on Load Settings.

Load pre-defined SMTP provider

In the next pop-up you’ll have a list of SMTP providers to choose from. For demonstration purposes, here we’ll be using Gmail as our SMTP provider.

Click on Load Settings. This will load the pre-defined server name and port.

Load pre-defined SMTP provider

Set up email account

Next up, you’ll want to set up the details for your mail account that will be sending all the emails in your store.

set up mail account SMTP

Authentication: set to Login

Username: set to the username name of the Gmail account that you want to be in charge of sending all the emails within your store

Password: enter your app’s password

Google’s app passwords are generated in the following page: https://accounts.google.com/IssuedAuthSubTokens?hide_authsub=1

You’ll want to create an app password here and use the generated app password for your SMTP configuration.

Generating an app-specific password for SMTP
Generating an app-specific password for SMTP

Test SMTP

All that’s left to do is to test your SMTP configuration. Expand the Send Test Email section and configure the following settings:

Send To: choose from one of the five email senders in Magento. Note that all emails will still be sent from the email address which you just configured above, and selecting different roles will only affect the sender’s name (e.g., Owner, Sales, Customer Support, etc)

Send from: select the destination email address

With proper configuration, you should be able to see this:

Test email sent successfully

And when going to the recipient’s inbox to check the test email, you should see something like this:

Test email SMTP Magento

Congratulations! You have successfully configured SMTP for your Magento store.

See also:
Magento Emails Not Sending
How to customize your Magento Email Templates

Dom

A knowledge craver who always strive to be wiser everyday.