定制 luchavez/aws-ses-bounce 二次开发

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

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

luchavez/aws-ses-bounce

Composer 安装命令:

composer require luchavez/aws-ses-bounce

包简介

Blacklisting bounced email addresses on AWS Simple Email Service (SES) for Laravel 8|9|10

README 文档

README

Latest Version on Packagist Total Downloads GitHub Repo stars Discord Twitter Follow

Using AWS Simple Email Service (SES) for sending emails and newsletters is very common in Laravel apps nowadays. AWS SES configurations for Laravel is easy to follow as well.

The problem now is the maintenance part of sending these emails. Sending emails to unverified addresses can cause bounces whereas sending too many emails can cause complaints. If these bounces and complaints are left unchecked, it may cause the reputation of the sender to be damaged.

According to this documentation, if the bounce or complaint rates are too high, AWS might place the account under review or pause the account's ability to send email.

The aim of this package, luchavez/aws-ses-bounce, is to monitor the email bounces, complaints, and successful deliveries. This package records the recipient email addresses and their bounces, complaints, and deliveries.

One cool feature of this package is the automatic blocking. When a set amount of bounces or complaints is reached, the email address causing that will be immediately blocked. Another cool feature would be the automatic removal of blocked email address from to, cc, and bcc recipients during email sending.

Here's the entity relationship diagram (ERD) of this package:

AWS SES Bounce ERD

Want to contribute? Visit contributing.md to see a todo list.

Installation

Via Composer

$ composer require luchavez/aws-ses-bounce:^1.0.0

Setting Up

  1. Run php artisan migrate to create the tables.

  2. Add these variables to .env file if you want to override the default values of the package's config.

Variable Name Default Value Description
ASB_API_MIDDLEWARE [] This will be used by all API routes within the package except the webhooks.
ASB_EMAIL_TEST_API_ENABLED true This route is used for sending test emails.
ASB_DUMP_URL config('app.url') This route will be used for dumping data. Useful for debugging.
ASB_DUMP_ENABLED false Decides whether the dump data route will be accessible or not.
ASB_VALIDATE_SIGNATURE false Decides whether to enforce signed routes.
ASB_MAX_BOUNCE_COUNT 3 Maximum bounce count an email can get before being blocked.
ASB_SOFT_DELETE_NOTIFICATIONS false Decides whether to soft-delete SES Feedback Notifications.
ASB_DELIVERIES_MAX_AGE_IN_DAYS 7 Maximum age in days of Delivery Notification.

Usage

AWS SES Bounce Service

The package provides a service called AwsSesBounce which you can use by calling its helper functions:

  1. awsSesBounce()
  2. aws_ses_bounce()

Here's the list of its available methods.

Method Name Return Type Description
getBlockedEmails Collection gets the list of blocked emails from cache
getApiMiddleware array gets the middleware for other API routes
filterBouncedEmails array separates rejected email address from accepted ones
isEmailTestApiEnabled bool checks if send test email API is enabled
sendTestEmail void sends test email to to, cc, and bcc recipients
getMaxBounceCount int gets maximum bounce count before automatic block
block void blocks an email address manually
unblock void unblocks an email address manually
getBounceReasons Collection gets list of possible bounce reasons
shouldSoftDeleteNotifications bool check whether to soft-delete or force-delete notifications
getDeliveryNotificationMaxAgeInDays int get maximum age in days for delivery notifications

GenerateAwsSesBounceSignedURLCommand Artisan Command

To be able to receive AWS SES feedbacks via AWS SNS Topics, you must generate first the endpoints by running:

php artisan asb:generate

You'll be getting something like this:

AWS SES Bounce HTTP Endpoints

Submit these endpoints to assigned DevOps personnel so they can set it up on AWS Console.

Routes

AWS SES Bounce Route List

Note: If APP_ENV is equal to production, api/aws-ses/test and api/aws-ses/dump routes will be disabled.

Resources

Change log

Please see the changelog for more information on what has changed recently.

Testing

To send test emails, you can use the /api/aws-ses/test route. Add to, cc, and bcc recipients - can be array or just a single value.

AWS SES Bounce Send Test Email

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email jamescarloluchavez@gmail.com instead of using the issue tracker.

Credits

License

Please see the license file for more information.

luchavez/aws-ses-bounce 适用场景与选型建议

luchavez/aws-ses-bounce 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.06k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 03 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 luchavez/aws-ses-bounce 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-22