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.
php artisan bundle:install sendgrid
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
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);