Is there a problem that needs an urgent fix?Urgent fix?Get emergency help →
Blog

Practical Magento 2 guides on upgrades, security, speed and migration, written by the MageBooster team.

Magento 2.4.9 SMTP with the free Mageplaza SMTP extension (Lesson 6)

Make Magento 2.4.9 send its emails through SMTP with the free Mageplaza SMTP extension: Composer install, SMTP settings, a test email, saving with config:set, a real store email and the Email Log.
Magento 2.4.9 SMTP with the free Mageplaza extension
Lesson 6MageBooster Lessons · Magento 2.4.9

Magento SMTP with the free Mageplaza SMTP extension

Make Magento 2.4.9 send its emails through your mail provider: install the free Mageplaza SMTP extension with Composer, fill in the SMTP settings, send a test email, save the settings, and follow a real store email into the inbox and the email log.

Updated October 2026Video about 7 minLevel Store owners and developers

Downloads

The settings script has placeholder values (smtp.example.com, store@example.com). Put in your mail provider’s values before you run it. It asks for the password, so no password is in the file.

Why SMTP

Without SMTP, Magento hands its emails to the server’s own mail program (sendmail). Those emails often land in spam or never arrive, because the server is not an authorised sender for your domain. With SMTP, your mail provider sends them, and its SPF and DKIM records for your domain let them reach the inbox.

Magento 2.4.9 has a basic SMTP option too: Stores › Configuration › Advanced › System › Mail Sending Settings › Transport. The free Mageplaza SMTP extension adds a Test Now button, ready-made settings for common providers, an email log with resend, and a developer mode that stops all emails on test copies.

Installing Mageplaza SMTP

The Composer package is mageplaza/module-smtp (version 4.7.27 in the video). Composer also installs mageplaza/module-core (1.6.0). Both are free, and both installed on Magento 2.4.9 with PHP 8.5. Run Composer as the user that owns the Magento files, not as root.

magento-smtp-install.shDownload

#!/bin/bash
# MageBooster lesson 6: install the free Mageplaza SMTP extension (Magento 2.4.9, production mode).
# Composer asks for your repo.magento.com keys (auth.json) if they are not set yet.
set -e
cd /var/www/magento
m() { sudo -u magento bin/magento "$@"; }
m maintenance:enable
sudo -u magento composer require mageplaza/module-smtp
m module:enable Mageplaza_Core Mageplaza_Smtp
m setup:upgrade
m setup:di:compile
m setup:static-content:deploy -f en_US en_GB de_DE
m maintenance:disable
m cache:flush
# production mode: OPcache keeps the old code until PHP-FPM reloads
sudo systemctl reload php8.5-fpm
In production mode, reload PHP-FPM after setup:di:compile, or OPcache keeps the old code. Deploy the static files for every locale your admin and store views use (in the video: en_US for the admin, en_GB and de_DE for the store views).

The SMTP settings

Stores › Configuration › Mageplaza Extensions › SMTP:

FieldValue in the videoOn a live store
Enable Mageplaza SMTPYesYes
Log EmailsYesYes: every email is saved in the Email Log
Clean Email Log Every10 (days)How many days the log is kept; empty or 0 = never cleaned
Host127.0.0.1 (Mailpit on the test server)Your provider’s SMTP host; Load Settings fills it for Gmail, Microsoft 365, Zoho and others
Port1025587 with TLS, or 465 with SSL
ProtocolNoneTLS or SSL
AuthenticationLOGINLOGIN (or what your provider asks for)
Usernamestore@example.comUsually your email address
Passworda dummy (Mailpit accepts any)Your SMTP password, or an app password
Return-Path EmailemptyWhere bounced emails go; empty = the sender address
Until you register the free extension with Mageplaza (name and email, then Activate Now under Module Information), the page shows “This extension is not actived” and Save Config stays grey. Register it, or save the settings with bin/magento config:set as below.

Sending a test email

Open Send Test Email under SMTP Configuration Options. Send From is a sender identity (General Contact in the video), Send To is your own address. Test Now uses the values in the form, so it works before you save them. “Sent successfully! Please check your email box.” means the SMTP server accepted the email.

On the test server in the video, Mailpit catches every email (SMTP on 127.0.0.1:1025, web inbox on port 8025), so nothing leaves the server.

Saving the settings

As the Magento file owner, set the same values with bin/magento config:set, then flush the cache. The password is stored encrypted.

magento-smtp-settings.shDownload

#!/bin/bash
# MageBooster lesson 6: Mageplaza SMTP settings with bin/magento config:set.
# Put in your mail provider's values first. The values in the video (127.0.0.1, port 1025, no encryption)
# only work with a local test inbox like Mailpit.
set -e
cd /var/www/magento
m() { sudo -u magento bin/magento "$@"; }
m config:set smtp/general/enabled 1
m config:set smtp/general/log_email 1
m config:set smtp/configuration_option/host smtp.example.com
m config:set smtp/configuration_option/port 587
m config:set smtp/configuration_option/protocol tls
m config:set smtp/configuration_option/authentication login
m config:set smtp/configuration_option/username store@example.com
# the password is stored encrypted; read it from the prompt so it stays out of your shell history
read -rsp "SMTP password: " PW; echo
m config:set smtp/configuration_option/password "$PW"
m cache:flush

A real store email

Create a customer account on the storefront. Magento sends the welcome email from the Customer Support sender (set in Lesson 4 under Store Email Addresses), now through SMTP. In the video it arrives in Mailpit from MageBooster Support.

The Email Log

Stores › SMTP › Email Logs lists every email the store sends: subject, sender, recipient, status and time. A failed email has the status Error; from Select you can View it or Resend it. Test emails from Test Now are not logged.

On a test or staging copy of your store, set Developer › Developer Mode to Yes: Magento then sends no emails at all, so real customers never get emails from the copy.

Troubleshooting

SymptomCause and fix
Test Now does nothingThe admin is missing the extension’s JavaScript (a 404 for mageplaza/testemail.js). Delete pub/static/adminhtml, pub/static/frontend and var/view_preprocessed/*, deploy the static files again, then flush the cache.
setup:di:compile fails with “generated/code/… cannot be deleted”Magento cron ran at the same time. Turn the cron off during the install, run the compile again, then turn the cron back on.
“Connection timed out” on Test NowThe host or port is wrong, or the server’s firewall or hosting provider blocks outgoing SMTP. Many hosts block port 25: use 587 or 465.
Authentication failedCheck the username and password; with Gmail or Microsoft 365 you often need an app password or OAuth2.
Emails arrive in spamSet up SPF, DKIM and DMARC for your domain at your mail provider, and send from an address on that domain.
Save Config is greyThe free extension is not registered: register it under Module Information, or use bin/magento config:set.

See what is set:

cd /var/www/magento
# what is set for SMTP (the password shows encrypted)
sudo -u magento bin/magento config:show | grep ^smtp/
# is the module enabled?
sudo -u magento bin/magento module:status Mageplaza_Smtp

Next lesson

Lesson 7: the store emails and their templates: order, invoice, shipment, credit memo, welcome and newsletter, and a branded email template.

Store emails not arriving?We set up SMTP, SPF and DKIM for Magento and Mage-OS stores, and test every store email before go-live.

▶ Watch every MageBooster lesson on YouTube: all lessons in order · subscribe to the channel

Installation guides: Magento 2.4.9 on Ubuntu Mage-OS Hyvä
Spotted a mistake on this page? Tell us and we will fix it right away.

Free Site Audit

Send your store details. We check speed, security and extensions, then reply with three quick wins within 3 working days.

Let's talk

Get a quote

Tell us about your store and we’ll reply within one working day. Prefer to chat? Say hello from WhatsApp

MageBooster Book a UnoPim demo See UnoPim live with products like yours. A new PIM or a move from Akeneo: we reply with a plan, a timeline and a quote.
✓ Official UnoPim partner✓ AI agent set up for your team✓ Connected to Magento
MageBooster Start your Hyvä project From scratch or from your current store. We reply with a project plan, a timeline and a quote.
✓ Design and structure by us✓ Hyvä-optimised server✓ Bonus modules included

MageBooster

Let us get in touch with you

Leave your details and your store address. We look at your store first and contact you within one business day, by phone, WhatsApp or email, whichever you prefer.

Partner with us