gcgov/bulk-email
Composer 安装命令:
composer require gcgov/bulk-email
包简介
Tap into the centralized bulk email manager
README 文档
README
Internal applications can include this package to generate bulk emails by subscribed channels or to send individual emails via the bulk email queue.
Installation
composer require gcgov/bulk-email
API Configuration
Prior to calling any methods in the library, define the api url and your access token.
\gcgov\framework\services\bulkEmail\config::setApiUrl( 'https://bulkemailapi.example.com' ); \gcgov\framework\services\bulkEmail\config::setApiAccessToken( '{jwt}' );
Debug Logging
To enable debug logging, add these lines prior to using the library.
\gcgov\framework\services\bulkEmail\config::setDebugLogging( true ); \gcgov\framework\services\bulkEmail\config::setDebugLogPath( 'C:/inetpub/logs' );
Save & Subscribe Email Addresses to Channels
This method will subscribe all provided email address to all provided channel ids. If a provided email address has existing channel subscriptions, the existing subscriptions will remain and new channels provided will be added as additional subscriptions. If a provided email address is already subscribed to a provided channel, the user will remain subscribed to that provided channel and new channels provided will be added as additional subscriptions.
// messageToChannel( string[] $emailAddresses, string[] $channelIds=[] ) \gcgov\framework\services\bulkEmail\bulkEmail::messageToChannel( ['jdoe@garrettcountymd.gov'], [ '64f1e3a45d0afbf5408370cc' ] );
Send a Bulk Email to Channel Subscribers
This method will queue the same message to every email address subscribed to a particular channel.
Actual mail sending is handled by the Bulk Email API and may be delayed based on message priority and sending limits.
$message = new \gcgov\framework\services\bulkEmail\models\messageToChannel(); //wrap $message->message with this template $message->template = \gcgov\framework\services\bulkEmail\models\template::countyTemplate2023; //if the brand heading should use department information, specify the id of the department to use. To use a generic leave null) //$message->sendingDepartmentId = '{departmentId}'; //send this message to all subscribers to this channel $message->channelId = '{channelId}'; //email subject line $message->subject = 'Subject'; //email html body - do not use full $message->message = '<div>HTML message body</div>'; //a reference to the event/item that generated this message $message->reference = 'website.article.id=1'; //send \gcgov\framework\services\bulkEmail\bulkEmail::messageToChannel( $message );
Send an Individual Email
To send an individual email, use bulkEmail::messageToEmail()
$message = new \gcgov\framework\services\bulkEmail\models\messageToEmail(); //wrap $message->message with this template $message->template = \gcgov\framework\services\bulkEmail\models\template::countyTemplate2023; //if the brand heading should use department information, specify the id of the department to use. To use a generic leave null) //$message->sendingDepartmentId = '{departmentId}'; //send this message to these email addresses $message->to = ['jdoe@garrettcountymd.gov']; //email subject line $message->subject = 'Subject'; //email html body - do not use full $message->message = '<div>HTML message body</div>'; //a reference to the event/item that generated this message $message->reference = 'payments.receipt.id=1'; //send \gcgov\framework\services\bulkEmail\bulkEmail::messageToEmail( $message );
gcgov/bulk-email 适用场景与选型建议
gcgov/bulk-email 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 68 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 09 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 gcgov/bulk-email 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gcgov/bulk-email 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 68
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-01