项目作者: robrogers3

项目描述 :
Mailjet Mail Transport for Laravel using Mailjet API V3
高级语言: PHP
项目地址: git://github.com/robrogers3/larajet.git
创建时间: 2016-11-11T20:31:15Z
项目社区:https://github.com/robrogers3/larajet

开源协议:MIT License

下载


Larajet

Package version
Software License
Total downloads

Larajet is a mail transport for Laravel. It is a MailJet integration package. Much like Mailgun, this allows for sending Mail via the mailjet api (based on Mailjet API v3.)
It supports Mailables and Notifables.

Install

Via Composer

  1. $ composer require robrogers/larajet

Configure

You will need to update app.php in the config directory:

In Package Service Providers section add:

  1. Larajet\MailjetServiceProvider::class

Also, add this line to the ‘aliases’ array

  1. 'MailJet' => Larajet\Facades\MailJet::class,

Then you need to update config/services.php. Add this under Third Party Services:

  1. 'mailjet' => [
  2. 'public_key' => env('MAILJET_PUBLIC_KEY'),
  3. 'private_key' => env('MAILJET_PRIVATE_KEY'),
  4. 'from' => env('MAIL_FROM'),
  5. 'driver' => env('MAIL_DRIVER'),
  6. 'guzzle' => [],
  7. 'api_url' => 'https://api.mailjet.com/v3/send'
  8. ],

Lasty, you will need to update your .env file accordingly to set your MailJet Public and Private keys.

  1. MAILJET_PUBLIC_KEY=YOUR_PUBLIC_KEY
  2. MAILJET_PRIVATE_KEY=YOUR_PRIVATE_KEY

Usage

The best way is to create a Mailable. e.g.

  1. php artisan make:mail TestMail

Then just mail it!

  1. use App\Mail\TestMail;
  2. Mail::to(fred@example.com)
  3. ->subject('Test Mail')
  4. ->send(new TestMail);

Learn about Mailables on laravel.com

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

  1. $ composer test

There is only one test. It tests the mail was sent.

Basically the steps are:

  • Call a console command, or hit a route that sends an email.
  • There are no more steps.

A route might look like:

  1. use App\Mail\TestMail;
  2. Route::get('/sendmail', function() {
  3. Mail::to(\App\User::first()->email)
  4. ->send(new TestMail);
  5. return 'sent?';
  6. });

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email robrogers@me.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.