Skip to content

Instantly share code, notes, and snippets.

@lexicalbits
Created March 20, 2014 17:36
Show Gist options
  • Save lexicalbits/9669433 to your computer and use it in GitHub Desktop.
Save lexicalbits/9669433 to your computer and use it in GitHub Desktop.
<?php
require('vendor/autoload.php');
$cfg = require('cfg.php'); //returns ['username'=>'???', 'password'=>'???']
$to = 'sgtest_to@mailinator.com';
$cc = 'sgtest_cc@mailinator.com';
$bcc = 'sgtest_bcc@mailinator.com';
$sg = new SendGrid($cfg['username'], $cfg['password']);
$m = (new SendGrid\Email())
->addTo($to)
->addCc($cc)
->addBcc($bcc)
->setFrom('sgtest_from@mailinator.com')
->setSubject('CC and BCC test')
->setText('Test')
->setHtml('<p>Test</p>')
;
$response = $sg->send($m);
var_dump($response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment