PHP code example of thedoctor0 / laravel-mailjet-driver
1. Go to this page and download the library: Download thedoctor0/laravel-mailjet-driver library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
thedoctor0 / laravel-mailjet-driver example snippets
'mailjet' => [
'key' => env('MAILJET_APIKEY'),
'secret' => env('MAILJET_APISECRET'),
],
'mailers' => [
// ...
'mailjet' => [
'transport' => 'mailjet',
],
],
'mailjet' => [
'key' => env('MAILJET_APIKEY'),
'secret' => env('MAILJET_APISECRET'),
'transactional' => [
'call' => true,
'options' => [
'url' => 'api.mailjet.com',
'version' => 'v3.1',
'call' => true,
'secured' => true,
],
],
'common' => [
'call' => true,
'options' => [
'url' => 'api.mailjet.com',
'version' => 'v3',
'call' => true,
'secured' => true,
],
],
'v4' => [
'call' => true,
'options' => [
'url' => 'api.mailjet.com',
'version' => 'v4',
'call' => true,
'secured' => true,
],
],
],
use App\Mail\OrderShipped;
use Illuminate\Support\Facades\Mail;
Mail::to($user)->send(new OrderShipped($order));
use Mailjet\LaravelMailjet\Facades\Mailjet;
Mailjet::sendEmail([
'Messages' => [
[
'From' => ['Email' => '[email protected] ', 'Name' => 'You'],
'To' => [['Email' => '[email protected] ', 'Name' => 'Passenger']],
'Subject' => 'Your booking is confirmed',
'TextPart' => 'See you soon!',
'HTMLPart' => '<h3>See you soon!</h3>',
],
],
]);
// Override the API version if you need the legacy v3 payload shape:
Mailjet::sendEmail($body, ['version' => 'v3']);
Mailjet::sendSms([
'From' => 'MyCompany',
'To' => '+33600000000',
'Text' => 'Your verification code is 123456',
]);
Mailjet::getAllLists($filters);
Mailjet::createList($body);
Mailjet::getListRecipients($filters);
Mailjet::getSingleContact($id);
Mailjet::createContact($body);
Mailjet::createListRecipient($body);
Mailjet::editListRecipient($id, $body);
use Mailjet\Resources;
Mailjet::get(Resources::$Contact, $args, $options);
Mailjet::post(Resources::$Contact, $args, $options);
Mailjet::put(Resources::$Contact, $args, $options);
Mailjet::delete(Resources::$Contact, $args, $options);