robrogers / larajet
Laravel Mail Transport for Mailjet
Installs: 5 166
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=5.6
- guzzlehttp/guzzle: ^6.2
- illuminate/support: >=5.1
Requires (Dev)
- laravel/framework: 5.3.*
- phpunit/phpunit: ~4.0||~5.0
- squizlabs/php_codesniffer: ^2.3
This package is auto-updated.
Last update: 2024-11-20 16:09:41 UTC
README
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
$ composer require robrogers/larajet
Configure
You will need to update app.php in the config directory:
In Package Service Providers section add:
Larajet\MailjetServiceProvider::class
Also, add this line to the 'aliases' array
'MailJet' => Larajet\Facades\MailJet::class,
Then you need to update config/services.php. Add this under Third Party Services:
'mailjet' => [ 'public_key' => env('MAILJET_PUBLIC_KEY'), 'private_key' => env('MAILJET_PRIVATE_KEY'), 'from' => env('MAIL_FROM'), 'driver' => env('MAIL_DRIVER'), 'guzzle' => [], 'api_url' => 'https://api.mailjet.com/v3/send' ],
Lasty, you will need to update your .env file accordingly to set your MailJet Public and Private keys.
MAILJET_PUBLIC_KEY=YOUR_PUBLIC_KEY
MAILJET_PRIVATE_KEY=YOUR_PRIVATE_KEY
Usage
The best way is to create a Mailable. e.g.
php artisan make:mail TestMail
Then just mail it!
use App\Mail\TestMail; Mail::to(fred@example.com) ->subject('Test Mail') ->send(new TestMail);
Learn about Mailables on laravel.com
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ 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:
use App\Mail\TestMail; Route::get('/sendmail', function() { Mail::to(\App\User::first()->email) ->send(new TestMail); return 'sent?'; });
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.