Skip to content

s-ichikawa/laravel-sendgrid-driver-v3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel SendGrid Driver (SendGrid API Version3)

if you need version2, here

SensioLabsInsight Build Status

A Mail Driver with support for Sendgrid Web API, using the original Laravel API. This library extends the original Laravel classes, so it uses exactly the same methods.

To use this package required your Sendgrid Api Key. Please make it Here.

#Install (Laravel5.1~)

Add the package to your composer.json and run composer update.

"require": {
    "s-ichikawa/laravel-sendgrid-driver": "^v5.1"
},

or installed with composer

$ composer require s-ichikawa/laravel-sendgrid-driver

Remove the default service provider and add the sendgrid service provider in config/app.php:

'providers' => [
//  Illuminate\Mail\MailServiceProvider::class,

    Sichikawa\LaravelSendgridDriver\MailServiceProvider::class,
];

Remove the default service provider and add the sendgrid service provider in config/app.php:

'providers' => [
//  'Illuminate\Mail\MailServiceProvider',

    'Sichikawa\LaravelSendgridDriver\MailServiceProvider',
];

Install (Lumen)

Add the package to your composer.json and run composer update.

"require": {
    "s-ichikawa/laravel-sendgrid-driver": "dev-master"
},

or installed with composer

$ composer require s-ichikawa/laravel-sendgrid-driver:dev-master

Add the sendgrid service provider in bootstrap/app.php

$app->configure('mail');
$app->configure('services');
$app->register(Sichikawa\LaravelSendgridDriver\MailServiceProvider::class);

unset($app->availableBindings['mailer']);

#Configure

.env

MAIL_DRIVER=sendgrid
SENDGRID_API_KEY='YOUR_SENDGRID_API_KEY'

config/service.php

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

#Use SMTP API

##This function is TODO now.

Sendgrid's SMTP API is so cool feature. This function can use by setting embed data to message. and, set 'sendgrid/x-smtpapi' to data name or content-type.

\Mail::send('view', $data, function (Message $message) {
    $message
        ->to('foo@example.com', 'foo_name')
        ->from('bar@example.com', 'bar_name')
        ->embedData([
            'categories' => ['user_group1']
        ], 'sendgrid/x-smtpapi');
});

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages