shivas / bouncer-bundle
Symfony2 扩展包,用于 AWS SES/SNS 反弹主题监听和 SwiftMailer 过滤器
0.2.0
2015-09-03 07:25 UTC
Requires
- php: >=5.4.0
- aws/aws-sdk-php: ~2.7
- symfony/framework-bundle: ~2.5
- symfony/swiftmailer-bundle: ~2.3
Requires (Dev)
- doctrine/common: ~2.4
- phpunit/phpunit: ~4.5
- symfony/console: ~2.5
- symfony/yaml: ~2.5
This package is auto-updated.
Last update: 2024-09-05 22:16:49 UTC
README
Symfony2 扩展包,用于自动使用 SwiftMailer 在项目内过滤出反弹的电子邮件接收者。
AWS SES 用户知道,如果你收到大量反弹电子邮件,AWS 会将你置于观察期。在某些情况下,没有简单的解决方案。此扩展包通过监听 AWS SNS 反弹主题并挂钩到您的身份,透明地过滤接收者列表,从而解决问题。
要求
- 您使用 AWS SES 发送电子邮件
- 您有 AWS API 密钥
- 您已确认电子邮件身份(电子邮件或整个域名)
安装
步骤 1:下载扩展包
打开命令行,进入您的项目目录,并执行以下命令以下载此扩展包的最新稳定版本
$ composer require shivas/bouncer-bundle "~0.1"
此命令要求您全局安装了 Composer,如 Composer 文档中的 安装章节 所述。
步骤 2:启用扩展包
然后,通过在您的项目 app/AppKernel.php
文件中添加以下行来启用扩展包
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Shivas\BouncerBundle\ShivasBouncerBundle(), ); // ... } // ... }
步骤 3:添加配置
# Default configuration for "ShivasBouncerBundle" shivas_bouncer: db_driver: orm # currently only ORM supported model_manager_name: null # if using custom ORM model manager, provide name, otherwise leave as null aws_api_key: key: ~ # Required, your AWS API KEY secret: ~ # Required, your AWS API SECRET region: us-east-1 # Required, region of AWS to use bounce_endpoint: route_name: _shivasbouncerbundle_bounce_endpoint protocol: HTTP # HTTP or HTTPS host: localhost.local # hostname of your project when in production filter: enabled: true # if false, no filtering of bounced recipients will happen filter_not_permanent: false # if false, all temporary bounces will not make that address to be filtered forever mailer_name: # array of mailer names where to register filtering plugin - default
添加反弹端点的路由文件(请随意编辑前缀)
# app/config/routing.yml bouncer: resource: @ShivasBouncerBundle/Resources/config/routing.yml prefix: /aws/endpoints
步骤 4:更新您的数据库模式
$ php app/console doctrine:schema:update --force
步骤 5:设置对反弹主题的订阅
在控制台运行
./app/console swiftmailer:sns:setup-bounce-topic Bounce
这将使用您的 AWS 密钥获取可用的身份,并为您提供选择要订阅哪些身份的选项。控制台中的“反弹”是要设置的主题名称(命名规则应遵循 AWS 主题命名规则)
将发生什么
- 将创建反弹主题
- 所有选定的身份都将配置为将反弹通知发送到该主题
- 您的项目 URL 将作为 HTTP 或 HTTPS(配置)端点提供给 AWS
- 在 AWS 请求确认时将自动发生订阅确认(如果您的端点是可达的)
贡献
通过问题或拉取请求进行贡献。
待办事项
通过 Doctrine 支持的 MongoDB 和其他数据库的映射