Search by

infrangible / m2-smtp

infrangible

Sends all store emails through your own SMTP servers, with a backup server, an automatic fallback, test mails and a log of every sent email.

Package info

github.com/infrangible-dev/m2-smtp

Homepage

Type:magento2-module

pkg:composer/infrangible/m2-smtp

Statistics

Installs: 253

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.0 2026-11-30 09:52 UTC

This package is auto-updated.

Last update: 2026-11-30 09:54:38 UTC


README

Sends the emails of the store through your own SMTP servers: a main server and a backup server, with an automatic fallback to Magento's own mail sending. Every email is logged with its addresses, subject, status, the server that sent it and the errors of the servers that failed. The configuration gets a button to send a test email with the entered settings before they are saved.

Configuration

Stores > Configuration > Infrangible Solutions > SMTP (default, website and store view scope):

  • General
    • Enable: sends the emails through the enabled servers and logs them. Without enabled servers, Magento sends them as usual and they are only logged. Disabled, the module neither sends nor logs.
    • Allow System Fallback: if no server could send an email, Magento sends it as usual. Without the fallback, the email fails with an error.
  • Server Priority #1 and Server Priority #2: the servers, tried in this order.
    • Host and Port (usually 587 for STARTTLS and 465 for SSL/TLS)
    • Encryption: None, STARTTLS or SSL/TLS
    • Authentication: None, PLAIN, LOGIN or CRAM-MD5, with User Name and Password (stored encrypted)
  • Log (default scope)
    • Store Content: stores the content of the emails in the log. The content contains personal data of the customers; switching it off removes the stored content with the nightly cleanup.
    • Retention in Days: log entries older than this are deleted every night (default 90, 0 keeps them).
  • Test Mail: choose a server, a sender identity of the store and one or more receivers (separated by semicolons), then click Send. The email is sent through the selected server only, with the settings entered on the page, so they can be tested before saving. The page shows whether the email was sent, or the error of the server. Only admin users who may change the configuration of SMTP (ACL resource Infrangible_Smtp::config_infrangible_smtp) can send it.

Magento's setting Set Return-Path (Stores > Configuration > Advanced > System > Mail Sending Settings) applies to the emails sent through the servers as well.

Log

Infrangible > SMTP > Log lists the sent emails with their status (Sending, Sent, Error), the server that sent them (Server Priority #1, Server Priority #2 or Magento) and the errors of the servers that failed before. The view of an entry shows the stored content; HTML emails are shown in a sandbox, without scripts. The log needs the ACL resource Infrangible_Smtp::smtp_log.

Magento versions

Magento 2.4.6 and 2.4.7 build the emails with Laminas Mime, the module sends them with Laminas Mail. Magento 2.4.8 and newer build them with Symfony Mime, the module sends them with Symfony Mailer. Both libraries come with Magento.

Requirements

  • Magento Open Source or Adobe Commerce 2.4.6 or newer
  • PHP 8.1 or newer

Installation

composer require infrangible/m2-smtp
bin/magento module:enable Infrangible_Smtp
bin/magento setup:upgrade

In production mode, also run bin/magento setup:di:compile.

License

Infrangible SMTP is licensed under the MIT License - see the LICENSE file for details.