olenchenko-a/laravel-sendpulse-mail
Composer 安装命令:
composer require olenchenko-a/laravel-sendpulse-mail
包简介
Laravel package for Sendpulse mail transport
README 文档
README
Laravel mail transport based on https://github.com/sendpulse/sendpulse-rest-api-php library
Installation:
composer require olenchenko-a/laravel-sendpulse-mail
Configuration:
In the config config/mail.php add a new transport:
return [ //... 'mailers' => [ //... 'sendpulse' => [ 'transport' => 'sendpulse', 'api_user_id' => env('SPAPI_USER_ID'), 'api_secret' => env('SPAPI_SECRET'), ], ] ]
Register the Service Provider
In config/app.php to providers section add
LaravelSendpulseMail\SendpulseMailServiceProvider::class,
In config/services.php add
'send_pulse' => [ 'api_user_id' => env('SPAPI_USER_ID'), 'api_secret' => env('SPAPI_SECRET'), ],
Add to your .env
MAIL_MAILER=sendpulse
And provide your sendpulse credentials
SPAPI_USER_ID="YOUR_USER_ID"
SPAPI_SECRET="YOUR_SECRET"
Package also provide EmailSend event which contain the result of the operation sending email. You can use it for additional validating email sending result
public function handle(EmailSend $event): void { if($event->result) { dispatch(function () use ($event) { $data = $this->client->get('smtp/emails/' . $event->emailId); if($data['smtp_answer_code'] != 250) { // Despite email was successfuly sent to Sendpulse, // it was not delivered to recepient } })->delay(now()->addMinutes(3)); } }
统计信息
- 总下载量: 172
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-25