Easily send Mailjet transactional email and sms with Laravel notifier.
owenoj/laravel-mailjet-notifier is a Laravel package for easily send mailjet transactional email and sms with laravel notifier..
It currently has 0 GitHub stars and 0 downloads on Packagist.
Install it with composer require owenoj/laravel-mailjet-notifier.
Discover more Laravel packages by owenoj
or browse all Laravel packages to compare alternatives.
Last updated
Easily send Mailjet transactional email and sms with Laravel notifier.
If you're just looking for a mailjet mail transport, check out mailjet/laravel-mailjet
Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.
composer require yieldstudio/laravel-mailjet-notifier
Just define these environment variables:
MAILJET_APIKEY=
MAILJET_APISECRET=
MAILJET_SMSTOKEN=
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=
MAILJET_SMS_SENDER=
MAILJET_DRY=true|false
Make sure that MAIL_FROM_ADDRESS is an authenticated email on Mailjet, otherwise your emails will not be sent by the Mailjet API.
MAILJET_SMS_SENDER should be between 3 and 11 characters in length, only alphanumeric characters are allowed.
When the dry mode is enabled, Mailjet API isn't called.
You can publish the configuration file with:
php artisan vendor:publish --provider="YieldStudio\LaravelMailjetNotifier\MailjetNotifierServiceProvider" --tag="config"
<?php
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use YieldStudio\LaravelMailjetNotifier\MailjetEmailChannel;
class OrderConfirmation extends Notification
{
public function via(): array
{
return [MailjetEmailChannel::class];
}
public function toMailjetEmail($notifiable): MailjetEmailMessage
{
return (new MailjetEmailMessage())
->templateId(999999) // Replace with your template ID
->to($notifiable->firstname, $notifiable->email)
->variable('firstname', $notifiable->firstname)
->variable('order_ref', 'N°0000001');
}
}
<?php
namespace App\Notifications;
use Illuminate\Notifications\Notification
;use YieldStudio\LaravelMailjetNotifier\MailjetSmsChannel;
use YieldStudio\LaravelMailjetNotifier\MailjetSmsMessage;
class ResetPassword extends Notification
{
public function __construct(protected string $code)
{
}
public function via()
{
return [MailjetSmsChannel::class];
}
public function toMailjetSms($notifiable): MailjetSmsMessage
{
return (new MailjetSmsMessage())
->to($notifiable->phone)
->text(__('This is your reset code :code', ['code' => $this->code]));
}
}
To run the tests, just run composer install and composer test.
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you've found a bug regarding security please mail [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.