summaryrefslogtreecommitdiffstats
path: root/lib/SendGridCompatibility/SendGrid.php
blob: 7f8697a363c6968072bef0c0806bc6efe3e8191a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
namespace SparkPost\SendGridCompatibility;

use SparkPost\SparkPost;
use SparkPost\SendGridCompatibility\Email;

class SendGrid{
  private $sparky;

  public function __construct($username, $password, $options = null, $httpAdapter) {
    //username isn't used in our system
    $opts = array('key'=>$password);
    if (!is_null($options)) {
      $opts = array_merge($opts, $options);
    }

    $this->sparky = new SparkPost($httpAdapter, $opts);
  }

  public function send(Email $email) {
    $this->sparky->transmission->send($email->toSparkPostTransmission());
  }
}
?>