doxxon/laravel-mandrill-request

通过Laravel 4发送Mandrill交易电子邮件

v1.0.1 2013-12-27 16:10 UTC

This package is not auto-updated.

Last update: 2024-09-28 13:01:51 UTC


README

从Laravel 4框架发送Mandrill交易电子邮件。此包是Laravel 4对MichMich的Laravel Mandrill Bundle的包装。

安装

  1. 编辑您的项目composer.json文件,并添加对doxxon/laravel-mandrill-request的需求。

     "require": {
     	"doxxon/laravel-mandrill-request": "dev-master"
     }
    
  2. 从命令行更新composer

     composer update
    
  3. 打开app/config/app.php,并在providers数组中添加以下行

     'Doxxon\LaravelMandrillRequest\LaravelMandrillRequestServiceProvider',
    
  4. 添加一个外观别名以启用简写使用。打开app/config/app.php,并在aliases数组中添加以下行

     'Mandrill' => 'Doxxon\LaravelMandrillRequest\Facades\MandrillRequest',
    
  5. 发布配置文件。这将允许您设置Mandrill API密钥

     php artisan config:publish doxxon/laravel-mandrill-request
    
  6. 通过编辑config/packages/doxxon/laravel-mandrill-request/config.php设置您的Mandrill API密钥

return array(

	'api_key' => 'your api key here',

);

Mandrill仪表板获取您的API密钥

使用方法

$payload = array(
	'message' => array(
        'subject' => 'Transactional email via Mandrill',
        'html' => 'It works!',
        'from_email' => 'fromemail@example.com',
        'to' => array(array('email'=>'toemail@example.com'))
   	)
);

$response = Mandrill::request('messages/send', $payload);

查看Mandrill API文档以获取更多信息