data33/laravel-mailgun
Composer 安装命令:
composer require data33/laravel-mailgun
包简介
Send emails from multiple domains with mailgun
README 文档
README
A package for sending emails using the Mailgun HTTP API. One of the main advantages is that you can send emails from any domains connected to your Mailgun API key.
Installation
Open your composer.json file and add the following to the require key:
"data33/laravel-mailgun": "^2"
After adding the key, run composer update from the command line to install the package
composer update
Configuration
Before you can start using the package we need to set some configurations.
To do so you must first publish the config file, you can do this with the following artisan command.
php artisan vendor:publish --provider="Data33\LaravelMailgun\Providers\MailgunServiceProvider" --tag="config"
After the config file has been published you can find it at: config/mailgun.php
In it you must specify your Mailgun API key.
Usage with Laravel
Mailgun::send('MAILGUN-URL', 'view', ['viewVariable' => 'value'], function(\Data33\LaravelMailgun\Message $msg){ $msg->setFromAddress('sender@YOUR-DOMAIN', 'Sender Name') ->addToRecipient('RECIPIENT-EMAIL', 'Recipient Name') ->setSubject('Test subject'); });
Usage without Laravel
The easiest way to use this package without Laravel is to directly instantiate a Transporter of your choice.
For example:
$mg = new Data33\LaravelMailgun\Transporters\AnlutroCurlTransporter('YOUR-MAILGUN-API-KEY'); $result = $mg->send('MAILGUN-URL', ['html' => '<b>Test</b>', 'text' => 'Test'], function(\Data33\LaravelMailgun\Message $msg){ $msg->setFromAddress('sender@YOUR-DOMAIN', 'Sender Name') ->addToRecipient('RECIPIENT-EMAIL', 'Recipient Name') ->setSubject('Test subject'); });
Upgrade from 1.3.0
Since EU domains need calls to a different API URL it seemed fitting to not keep it hardcoded within this package. To upgrade your old code base, change the first argument from domain name to the full URL to Mailgun's Messages API for your domain For example:
$mg = new Data33\LaravelMailgun\Transporters\AnlutroCurlTransporter('YOUR-MAILGUN-API-KEY');
-$result = $mg->send('mydomain.com', ['html' => '<b>Test</b>', 'text' => 'Test'], function(\Data33\LaravelMailgun\Message $msg){
+$result = $mg->send('https://api.mailgun.net/v3/mydomain.com/messages', ['html' => '<b>Test</b>', 'text' => 'Test'], function(\Data33\LaravelMailgun\Message $msg){
$msg->setFromAddress('sender@YOUR-DOMAIN', 'Sender Name')
->addToRecipient('RECIPIENT-EMAIL', 'Recipient Name')
->setSubject('Test subject');
});
data33/laravel-mailgun 适用场景与选型建议
data33/laravel-mailgun 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.09k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 08 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「mailgun」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 data33/laravel-mailgun 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 data33/laravel-mailgun 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 data33/laravel-mailgun 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Mailgun integration for SilverStripe emails
Email+ extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
Alfabank REST API integration
PHP: EMailer for 7OS, uses mailgun and other APIs
PHP module for Mailgun email sender
Mailgun handler for Monolog
统计信息
- 总下载量: 16.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-08-15