expertcoder/swiftmailer-send-grid-bundle
Composer 安装命令:
composer require expertcoder/swiftmailer-send-grid-bundle
包简介
Swiftmailer Transport and Symfony bundle for Sendgrid
README 文档
README
SwiftmailerSendGridBundle
Symfony bundle for SendGrid. Utilizes the SendGrid PHP Library https://github.com/sendgrid/sendgrid-php to make it compatiable with SwiftMailer.
Older version (1.x) can be found here: https://github.com/expertcoder/SwiftmailerSendGridBundle/tree/1.x
Installation
composer require expertcoder/swiftmailer-send-grid-bundle
or manually
composer.json
"require": { ... "expertcoder/swiftmailer-send-grid-bundle": "~2.0" }
config/packages/swiftmailer.yaml
swiftmailer: transport: expertcoder_swift_mailer.send_grid
Don't forget to set your Sendgrid API Key in your .env file, and that you can set your mail's categories from config/packages/expert_coder_swiftmailer_send_grid.yaml
Applications that don't use Symfony Flex
AppKernel.php
$bundles = [ // ... new ExpertCoder\Swiftmailer\SendGridBundle\ExpertCoderSwiftmailerSendGridBundle(), ];
parameters.yml.dist
parameters: sendgrid_api_key: PleaseEnterSendGridApiKey
config.yml
swiftmailer: transport: expertcoder_swift_mailer.send_grid expert_coder_swiftmailer_send_grid: api_key: %sendgrid_api_key% categories: [my_category] # optional, will be added to all mails sent (can be seen on sendgrid dashboard)
Symfony 3
Since Symfony 3.2, you must name the custom transport service swiftmailer.mailer.transport.< name > so you can use one of the solutions below:
services.yml
services: swiftmailer.mailer.transport.expertcoder_swift_mailer.send_grid.transport: alias: expertcoder_swift_mailer.send_grid.transport
OR
config.yml
swiftmailer: transport: 'swiftmailer.mailer.transport.expertcoder_swift_mailer.send_grid'
Tests
This bundle provide a little helper to launch tests locally and here is a quick explanation:
- The
config_test.ymlfile contains configuration associated with the bundle. - The
manual-test.shhelps you test against a specific symfony version and is the main helper to execute tests. You just have to dosh tests/manual-test.sh versionNumberwhere versionNumber is the main Symfony version you want to test (ex: 4) - The last file contains PhpUnit tests with help of
nyholm/symfony-bundle-test. Note that we set a timeout of 1sec when sending mail to sendgrid as we do not test the actual sendgrid API with a real key.
Important !
Following RFC 1341, section 7.2, if either text/html or text/plain are to be sent in your email: text/plain needs to be first, followed by text/html, followed by any other content.
For more informations, please see SwiftMailer and RFC 1341
expertcoder/swiftmailer-send-grid-bundle 适用场景与选型建议
expertcoder/swiftmailer-send-grid-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 241.68k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2016 年 11 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 expertcoder/swiftmailer-send-grid-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 expertcoder/swiftmailer-send-grid-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 241.68k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 16
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-24