定制 haerriz/module-smtprouting 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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\Transport via a lightweight Plugin.
  • Pulls credentials securely from Magento's env.php without 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

  1. 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'
],
  1. Configure your primary Magento SMTP fallback credentials in Stores > Configuration > Advanced > System > SMTP as usual. If an email is sent that does not match a specific mapping in env.php, it will fall back to the primary credentials.

License

MIT

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固