承接 gcgov/bulk-email 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

gcgov/bulk-email

最新稳定版本:v2.0.1

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 );

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-01