etailors/mautic-amazon-ses 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

etailors/mautic-amazon-ses

Composer 安装命令:

composer require etailors/mautic-amazon-ses

包简介

Amazon SES Mailer Plugin for Mautic

README 文档

README

This plugin provides integration between Mautic 5, 6 and 7 and Amazon SES for sending emails through AWS. It also integrates with Amazon SNS for handling email feedback such as bounces and complaints via callbacks. (PHP >= 8.1 required; Note: Mautic 7 itself requires PHP 8.2)

This is a custom plugin inspired by the structure of:

Feel free to suggest improvements or provide feedback — this is my first Mautic plugin and community contributions are welcome.

Features

  • Send emails through Amazon SES using the API.
  • Support for setting AWS regions and optional custom rate limits in the DSN.
  • Integration with Amazon SNS to process bounces and complaints via callback.
  • Built-in rate limiting to honor SES sending quotas.
  • Dynamic batch size matching the current SES max send rate.
  • Auto-fetch and cache your SES sending quota.
  • Manual override of rate limit with ratelimit DSN option.
  • Optional retry handling for partial email failures.

Installation

1. Download and Install the Plugin

Install manual

  1. Download or clone the repository to your Mautic plugins directory:

    cd /path/to/your/mautic/plugins
    git clone https://github.com/yourusername/mautic-aws-ses-plugin.git AmazonSesBundle
  2. Clear Mautic’s cache:

    php /path/to/mautic/bin/console cache:clear
  3. Go to Mautic Settings > Plugins and click the “Install/Update Plugins” button.

Install via Composer

If you prefer installing via Composer, run the following command from your Mautic root directory:

composer require etailors/mautic-amazon-ses:^1.0 -W 

Version number

Then clear the cache and reload the plugins:

rm -rf var/cache/*
php bin/console mautic:plugins:reload

Note:
The plugin will automatically install into plugins/AmazonSesBundle.

2. Configure Amazon SES Settings

  1. In Mautic, navigate to Settings > Email Settings.

  2. Select the newly installed AWS SES option.

  3. In the DSN field, enter your connection string in the following format:

    mautic+ses+api://<AWS_ACCESS_KEY>:<AWS_SECRET_KEY>@default?region=<AWS_REGION>&ratelimit=14
    
    • Replace <AWS_ACCESS_KEY> and <AWS_SECRET_KEY> with your AWS credentials.
    • Replace <AWS_REGION> with your AWS region (e.g., us-east-1).
    • Optionally set ratelimit to override the SES max send rate manually.
  4. Set the region in the options parameter, for example:

    Label: region   Value: eu-west-1
    

Amazon SES Integration

3. AWS SES Configuration

  1. Ensure that you have verified your domain and email addresses in AWS SES.

  2. Set up the appropriate IAM user with permissions to send emails via SES.
    Please make sure you create a new IAM user directly via IAM instead of upgrading an SMTP user with the permission: sending via SES API.

    There are known issues when upgrading SMTP-only users — see: issue #28.

Your IAM user must have permission to send and get account limits. Here’s an example policy:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowSesSendingAndQuota",
      "Effect": "Allow",
      "Action": [
        "ses:SendEmail",
        "ses:SendRawEmail",
        "ses:GetSendQuota"
      ],
      "Resource": [
        "arn:aws:ses:<region>:<account id>:identity/*",
        "arn:aws:ses:<region>:<account id>:configuration-set/*"
      ]
    }
  ]
}

4. Available Regions

af-south-1
ap-northeast-1
ap-northeast-2
ap-south-1
ap-southeast-1
ap-southeast-2
ca-central-1
eu-central-1
eu-north-1
eu-west-1
eu-west-2
eu-west-3
sa-east-1
us-east-1
us-east-2
us-gov-west-1
us-west-1
us-west-2

SNS Callback Configuration

To receive feedback from Amazon SES regarding bounces and complaints, you need to set up Amazon SNS.

  1. Go to your Amazon SNS Dashboard.

  2. Create a new Topic (or use an existing one) for SES feedback.

  3. Subscribe to this topic with an HTTPS endpoint using the following URL:

    https://<your-mautic-instance-url>/mailer/callback
    
  4. Ensure your topic sends notifications for bounces, complaints, and delivery status.

  5. Test your callback configuration by sending test emails and reviewing Mautic logs to verify feedback is processed correctly.

Batch Limit & Throttling

To avoid exceeding SES rate limits, this plugin automatically:

  • Caches the current maxSendRate returned by AWS SES.
  • Dynamically adjusts the batch size to match that rate.
  • Throttles outgoing email API calls using usleep().
  • Allows overriding the send rate via ratelimit DSN option.

This prevents common errors like TooManyRequests while maximizing throughput.

Debugging

  • To troubleshoot email sending or SNS callback issues, check Mautic’s logs:

    /path/to/mautic/var/logs
    
  • You can also monitor SES and SNS performance in Amazon CloudWatch.

Contributions & Feedback

This is my first Mautic plugin, so I’m open to any feedback or improvements.
Feel free to open an issue or submit a pull request if you find a bug or have a feature request!

License

This project is licensed under the MIT License — see the LICENSE file for details.

Changelog

See CHANGELOG.md for release notes. Version 1.0.31 maintains compatibility with PHP 8.1 for Mautic 6 users, while supporting Mautic 7 (which requires PHP 8.2).

etailors/mautic-amazon-ses 适用场景与选型建议

etailors/mautic-amazon-ses 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.15k 次下载、GitHub Stars 达 57, 最近一次更新时间为 2025 年 11 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「plugin」 「integration」 「Mautic」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 etailors/mautic-amazon-ses 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 etailors/mautic-amazon-ses 我们能提供哪些服务?
定制开发 / 二次开发

基于 etailors/mautic-amazon-ses 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 57
  • Watchers: 5
  • Forks: 45
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2025-11-09