mrvokia / mailhub
v1.0.3
2017-05-18 03:34 UTC
Requires
- php: >=5.5.9
Requires (Dev)
- phpunit/phpunit: ~4.1
This package is not auto-updated.
Last update: 2022-02-01 13:16:07 UTC
README
#MailHub
语言: 中文
MailHub 是一个用于 Laravel 的邮件包。
它通过 Laravel 的 SwiftMail 集成第三方邮件服务,为邮件操作提供统一协议。通过规则引擎,邮件由相应的发送者发送到不同的域名。
- 提供优雅的邮件界面,代替 SwiftMail
- 连接到 SwiftMail 之外的第三方邮件服务
- 目前实现了 SendCloud 的邮件发送
- 计划在下一个版本中实现标签和队列
- 欢迎讨论和 PR
##安装方法
# The introduction of dependent libraries
composer require mrvokia/mailhub:"dev-master@dev" -vvv
# Added service provider in the providers
MrVokia\MailHub\MailHubServiceProvider::class
# Add the aliases facade
'MailHub' => MrVokia\MailHub\MailHubFacade::class
# Composer auto load
composer dump
# Push Profile mailhub
php artisan vendor:publish
##使用方法
use MrVokia\MailHub\MailHub; /** * Send mail */ public function example(MailHub $mailhub) { $mailhub->send() ->to(['1@test.com', '2@test.com']) ->cc(['3@test.com']) ->subject('example') ->html('example content') ->start() //or MailHub::send() ->to(['1@test.com', '2@test.com']) ->cc(['3@test.com']) ->subject('example') ->html('example content') ->start() } /** * Send template mail */ public function exampleTemplate(MailHub $mailhub) { $mailhub->send() ->to(['1@test.com', '2@test.com']) ->subject('example') ->xsmtpapi([ 'active' => ['test', 'test2'] ]) ->templateInvokeName('mail.register') ->start() //or MailHub::send() ->to(['1@test.com', '2@test.com']) ->cc(['3@test.com']) ->subject('example') ->xsmtpapi([ 'active' => ['test', 'test2'] ]) ->templateInvokeName('mail.register') ->start() }
##参数:
参数 | 默认 | 其他 | 描述 |
---|---|---|---|
网关 |
'' |
swiftmail / sendcloud |
指定发送的网关 |
异步 |
false |
true |
指定第三方邮件(SendCloud)是否需要使用异步发送,以减少打开后的客户端响应时间 |
环境 |
false |
true |
指定是否在消息模板底部显示 APP_ENV。启用时,在邮件模板中添加 { {{$ env or ''}} `` 到当前的 APP_ENV 名称(为了保持生产环境整洁,APP_ENV = product 不会被显示) |
模拟 |
false |
true |
指定是否拦截消息,使消息发送到指定的邮箱,mailhub 配置文件中的 `mail_testname 配置的邮箱地址 |
队列 |
false |
true |
指定是否启用 SMTP 邮件队列。请参阅 Laravel 文档进行队列配置 |
队列目标 |
邮件器 |
'' |
指定 SMTP 邮件队列管道名称 |
##感谢