haerriz/module-smtprouting
Composer 安装命令:
composer require haerriz/module-smtprouting
包简介
Custom SMTP Routing module for Magento 2. Dynamically swaps SMTP credentials based on outgoing From address.
README 文档
README
A lightweight Magento 2 module that dynamically intercepts outgoing emails and swaps the SMTP authentication credentials based on the From email address.
This is extremely useful for shared hosting environments (like Hostinger) that enforce strict anti-spoofing policies (e.g., 553 Sender address rejected: not owned by user), requiring the SMTP login to match the exact outgoing email address.
Features
- Bypasses strict anti-spoofing policies on shared hosting.
- Natively intercepts Magento's core
Magento\Email\Model\Transportvia a lightweight Plugin. - Pulls credentials securely from Magento's
env.phpwithout hardcoding passwords in the database. - Completely eliminates the need for bulky, paid SMTP extensions.
Installation via Composer
composer require haerriz/module-smtprouting bin/magento module:enable Haerriz_SmtpRouting bin/magento setup:upgrade bin/magento setup:di:compile
Configuration
- In your server's
app/etc/env.php, add an array mapping your sender emails to their SMTP passwords:
'smtp_mapping' => [ 'orders@yourstore.com' => 'orders_password', 'newsletter@yourstore.com' => 'newsletter_password', 'support@yourstore.com' => 'support_password' ],
- Configure your primary Magento SMTP fallback credentials in
Stores > Configuration > Advanced > System > SMTPas usual. If an email is sent that does not match a specific mapping inenv.php, it will fall back to the primary credentials.
License
MIT
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-13