Search by

maxcode / module-store-smtp

eBusiness360

EN: Makes the native SMTP settings of Magento 2.4.8+ apply per store view: every transactional email is sent with the SMTP server of its own store, also when it is sent from the admin, by cron or asynchronously. FR : Applique par vue magasin les réglages SMTP natifs de Magento 2.4.8+ : chaque e-mail

Package info

github.com/eBusiness360/module-store-smtp

Type:magento2-module

pkg:composer/maxcode/module-store-smtp

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.2 2026-12-02 15:02 UTC

This package is auto-updated.

Last update: 2026-12-02 16:02:14 UTC


README

English · Français

Magento 2.4.8 has a native SMTP transport (Stores > Configuration > Advanced > System > Mail Sending Settings) and its fields can be set per store view. But the transport reads them for the store that happens to be active when the email leaves, not for the store the email belongs to:

Email sent… Native 2.4.8 uses the SMTP of…
from the storefront of store view B store view B ✔
from the admin (invoice, credit memo, shipment, "Send Email", resend) the default scope ✘
by cron or asynchronously the default store view ✘

In a multi-store shop with one SMTP account per brand, admin and cron emails of store view B leave through the server of the default scope, with the sender address of store B: SPF and DMARC fail and Gmail rejects them.

What it does

  • Every email built by Magento's TransportBuilder is sent with the system/smtp/* settings of its own store view: transport, host, port, username, password, auth, SSL, Return-Path, and "Disable Email Communications".
  • The store comes from what Magento already gives the builder: setTemplateOptions(['store' => …]), or the sender scope setFromByScope($from, $storeId).
  • No new screen, nothing to configure: it uses the native fields. A short note under Transport says they now apply per store view.
  • An email without a store, or for the admin store, behaves exactly as without the module.
  • No core override, no database table: one plugin on TransportBuilder, one configuration reader given to the native transport, and the native "disable" plugin replaced by a store-aware one.

Requirements and installation

Magento Open Source / Adobe Commerce 2.4.8 or later, PHP 8.2 to 8.4.

composer require maxcode/module-store-smtp
bin/magento module:enable Maxcode_StoreSmtp
bin/magento setup:upgrade

Tests

  • Unit: vendor/bin/phpunit -c app/code/Maxcode/StoreSmtp/dev/phpunit.xml (from the Magento root).
  • Integration: see dev/phpunit.integration.xml.

Français

Magento 2.4.8 a un transport SMTP natif (Magasins > Configuration > Avancé > Système > Paramètres d'envoi des e-mails), réglable par vue magasin. Mais il lit ces réglages pour la boutique active au moment de l'envoi, pas pour la boutique de l'e-mail : les e-mails envoyés depuis l'admin (facture, avoir, expédition, renvoi), par le cron ou en asynchrone partent par le SMTP par défaut, avec l'expéditeur de la boutique B. SPF et DMARC échouent et Gmail les refuse.

Ce module fait partir chaque e-mail avec les réglages system/smtp/* de sa vue magasin (transport, hôte, port, identifiant, mot de passe, authentification, SSL, Return-Path, « Désactiver les communications par e-mail »). La boutique est celle que Magento donne déjà au constructeur de message (setTemplateOptions ou setFromByScope). Aucun nouvel écran, aucun réglage, aucune réécriture du cœur ; sans boutique connue, le comportement natif est conservé.

Licence : voir le fichier LICENSE.