Skip to content

brianmdavis/SendGrid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SendGrid Bundle

Bundled up SendGrid PHP library for Laravel. SendGrid is a cloud-based email service which allows you to send emails from your applications in a reliable way.

For documentation and examples see the sendgrid-php library or README.git file in the bundle.

Installation

php artisan bundle:install sendgrid

Bundle Registration

Add the following to your application/bundles.php file:

'sendgrid' => array(
    'auto' => true
),

You will also need to add your username and password in config/options.php

Usage

The library has been modified to use a config file for username & password so you don't need to use it every time. Please keep this in mind when following examples from the original documentation.

Following example will get you started, shamelessly copied from the sendgrid-php docs.

$sendgrid = new SendGrid('username', 'password'); // This is original
$sendgrid = new SendGrid(); // For Laravel bundle users

Create a new SendGrid Mail object and add your message details

$mail = new SendGrid\Mail();
$mail->addTo('[email protected]')->
       setFrom('[email protected]')->
       setSubject('Subject goes here')->
       setText('Hello World!')->
       setHtml('<strong>Hello World!</strong>');

Send it using the API of your choice (SMTP or Web)

$sendgrid->smtp->send($mail);

Or

$sendgrid->web->send($mail);

About

SendGrid bundle for Laravel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%