- 授权协议: 未知
- 开发语言: PHP
- 操作系统: 跨平台
- 软件首页: https://github.com/NauxLiu/Laravel-SendCloud
- 软件文档: https://github.com/NauxLiu/Laravel-SendCloud
软件介绍
Laravel 5.1 的 SendCloud 驱动
普通发送方式完全兼容官方用法,可随时修改配置文件改为其他驱动,而不需要改动业务代码
安装
在项目目录下执行
composer require naux/sendcloud
配置
修改 config/app.php,添加服务提供者
'providers' => [ // 添加这行 Naux\Mail\SendCloudServiceProvider::class,];
在 .env 中配置你的密钥, 并修改邮件驱动为 sendcloud
MAIL_DRIVER=sendcloud SEND_CLOUD_USER= # 创建的 api_user SEND_CLOUD_KEY= # 分配的 api_key
使用
普通发送:
用法完全和系统自带的一样, 具体请参照官方文档: http://laravel.com/docs/5.1/mail
Mail::send('emails.welcome', $data, function ($message) {
$message->from('us@example.com', 'Laravel');
$message->to('foo@example.com')->cc('bar@example.com');
});模板发送
用法和普通发送类似,不过需要将 body 设置为 SendCloudTemplate 对象,达到目的有几种方法
Mail::send('随便传个空view', [], function ($message) {
$message->from('us@example.com', 'Laravel');
$message->to('foo@example.com')->cc('bar@example.com');
// 模板变量
$bind_data = ['url' => 'http://naux.me'];
$template = new SendCloudTemplate('模板名', $bind_data);
$message->getSwiftMessage()->setBody($template);
});// 模板变量
$bind_data = ['url' => 'http://naux.me'];
$template = new SendCloudTemplate('模板名', $bind_data);
Mail::raw($template, function ($message) {
$message->from('us@example.com', 'Laravel');
$message->to('foo@example.com')->cc('bar@example.com');
});看了上面两种用法,其他用法对照官方文档也能猜出来了吧,如使用 queue 发送等 ~
系统程序员成长计划
李先静 / 人民邮电出版社 / 2010-04 / 45.00
在学习程序开发的过程中,你是否总是为自己遇到的一些问题头疼不已,你是否还在为写不出代码而心急如焚?作为软件开发人员,你是否时时为自己如何成为一名合格的程序员而困惑不已?没关系,本书将为你排忧解难。 这是一本介绍系统程序开发方法的书。书中结合内容详尽的代码细致讲述了不少底层程序开发基础知识,并在逐步深入的过程中介绍了一些简单实用的应用程序,最后还讲述了一些软件工程方面的内容,内容全面,语言生动......一起来看看 《系统程序员成长计划》 这本书的介绍吧!
