LaravelPackages.net
Acme Inc.
Toggle sidebar
cuonggt/laravel-sendgrid-notification-channel

SendGrid Notification Channel for Laravel.

2.647
2
v1.0.0
About cuonggt/laravel-sendgrid-notification-channel

cuonggt/laravel-sendgrid-notification-channel is a Laravel package for sendgrid notification channel for laravel.. It currently has 2 GitHub stars and 2.647 downloads on Packagist (latest version v1.0.0). Install it with composer require cuonggt/laravel-sendgrid-notification-channel. Discover more Laravel packages by cuonggt or browse all Laravel packages to compare alternatives.

Last updated

SendGrid Mail Notifications

Prerequisites

SendGrid supports sending emails using it's pre-defined templates to format mail messsages. Before you can send SendGrid Mail notifications, you need to install the notification channel via Composer:

cuonggt/laravel-sendgrid-notification-channel

Next, you will need to add a few configuration options to your config/services.php configuration file. You may copy the example configuration below to get started:

'sendgrid' => [
    'api_key' => env('SENDGRID_API_KEY'),
],

Formatting SendGrid Mail Notifications

You should define a toSendGrid method on the notification class. This method will receive a $notifiable entity and should return a Illuminate\Notifications\Messages\SendGridMessage instance:

/**
 * Get the SendGrid representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return SendGridMessage
 */
public function toSendGrid($notifiable)
{
    return (new SendGridMessage('Your SendGrid template ID'))
                ->from('[email protected]', 'Example User')
                ->to('[email protected]', 'Example User1');
}

Star History Chart