timfeid / laravel-sendgrid by timfeid1

Add sendgrid api methods to Laravel's Mail
564
3
2
Package Data
Maintainer Username: timfeid1
Maintainer Contact: tim.feid@roubini.com (Tim Feid)
Package Create Date: 2016-11-11
Package Last Update: 2018-04-17
Language: PHP
License: MIT
Last Refreshed: 2024-11-22 03:16:46
Package Statistics
Total Downloads: 564
Monthly Downloads: 2
Daily Downloads: 0
Total Stars: 3
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

Laravel Sendgrid

Installation

config/app.php

    // Remove or comment out:
    // Illuminate\Mail\MailServiceProvider::class,
    // Add
    TimFeid\LaravelSendgrid\LaravelSendgridServiceProvider::class,

config/services.php

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

.env

SENDGRID_API_KEY=[your_api_key]

Usage

    Mail::send('email.forgot-password', [], function ($mail) {
        // Added category functionality
        $mail->category('forgot-password');
        // Added custom arguments functionality
        $mail->uniqueArgs(['user_id' => 1]);

        // Default Laravel functionality
        $mail->to('email@address.com');
        $mail->subject('Crazy subject');
    });