Laravel-SendCloudLaravel 5.1 的 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
发送等 ~
评论
gojaES51Go 实现的 ECMAScript 5.1(+)
goja 是一个 Go 实现的 ECMAScript 5.1(+)。它不是 V8 或 SpiderM
gojaES51Go 实现的 ECMAScript 5.1(+)
0
gojaES51Go 实现的 ECMAScript 5.1(+)
goja 是一个 Go实现的 ECMAScript5.1(+)。它不是V8或SpiderMonkey或任何其他通用JavaScript引擎的替代品,因为它更慢。它可以作为一种嵌入式脚本语言使用,或者可
gojaES51Go 实现的 ECMAScript 5.1(+)
0
SendCloud邮件发送平台
SendCloud是是致力于为企业客户提供高质量的触发邮件服务的云端邮件发送平台。为企业客户提供便利的API接口来调用服务,让邮件准确迅速到达用户收件箱并获得丰富的追踪数据。主要提供两种类型的邮件发送服务,一类是事务性邮件,一类是商务性邮件。
闪达科技
0
SendCloud PHP SDKSendCloud 的 PHP SDK 包
SendCloudPHPSDK,SendCloud的PHPSDK包。使用方法获取用户信息(在examples文件夹中)//自己的API_User和API_KEYdefine('API_USER','t
SendCloud PHP SDKSendCloud 的 PHP SDK 包
0
SendCloud PHP SDKSendCloud 的 PHP SDK 包
SendCloud PHP SDK,SendCloud 的 PHP SDK 包。使用方法获取用户信息
SendCloud PHP SDKSendCloud 的 PHP SDK 包
0
SendCloud短信发送平台
SendCloud短信服务平台是基于云端技术提供的触发短信高效送达、短信追踪及其他服务的短信发送平台。为企业客户提供便利的API接口来调用服务,让短信准确迅速到达用户手机短信收件箱并获得丰富的追踪数据。
闪达科技
0
SendCloud邮件发送API
SendCloud致力于为企业客户提供多样化、策略化的邮件发送方案,让发信频率稳定可控。企业客户通过API接口来调用服务,让邮件准确迅速到达用户收件箱并获得丰富的追踪数据。
闪达科技
0
sql4esElasticsearch 的 JDBC 驱动
sql4es,即Sql-for-Elasticsearch,是Elasticsearch的JDBC驱动程序。用于Elasticsearch2.0-2.4版本实现大多数JDBC接口:Connection
sql4esElasticsearch 的 JDBC 驱动
0