summaryrefslogtreecommitdiffstats
path: root/lib/MessageSystems/SendGridCompatibility
diff options
context:
space:
mode:
authornornholdj <nornholdj@gmail.com>2014-10-28 17:36:58 -0400
committernornholdj <nornholdj@gmail.com>2014-10-28 17:36:58 -0400
commite8e8cabb77bdf994a78f3f3a66ae3bdeb2da3d48 (patch)
treedfc0587d65e535a4af43df659ad793ee79106a15 /lib/MessageSystems/SendGridCompatibility
parentc004fdc8fd6140d0074000ae112e7d0ca70437c1 (diff)
downloadphp-sparkpost-e8e8cabb77bdf994a78f3f3a66ae3bdeb2da3d48.zip
php-sparkpost-e8e8cabb77bdf994a78f3f3a66ae3bdeb2da3d48.tar.gz
php-sparkpost-e8e8cabb77bdf994a78f3f3a66ae3bdeb2da3d48.tar.bz2
MA-946 #time 10h Updated examples and tested. Updated Documentation. Setup composer inclusion testing.
Diffstat (limited to 'lib/MessageSystems/SendGridCompatibility')
-rw-r--r--lib/MessageSystems/SendGridCompatibility/Email.php84
-rw-r--r--lib/MessageSystems/SendGridCompatibility/SDK.php24
2 files changed, 108 insertions, 0 deletions
diff --git a/lib/MessageSystems/SendGridCompatibility/Email.php b/lib/MessageSystems/SendGridCompatibility/Email.php
new file mode 100644
index 0000000..68c94b7
--- /dev/null
+++ b/lib/MessageSystems/SendGridCompatibility/Email.php
@@ -0,0 +1,84 @@
+<?php
+namespace MessageSystems\SendGridCompatibility;
+
+use MessageSystems\Transmission;
+
+class Email {
+ private $transmission;
+
+ public function __construct() {
+ $this->transmission = new Transmission();
+ }
+
+ public function send() {
+ $this->transmission->send();
+ }
+
+ public function addTo($address) {
+ $this->transmission->addRecipient($address);
+ return $this;
+ }
+
+ public function setTos(Array $addresses) {
+ $this->transmission->addRecipients($addresses);
+ return $this;
+ }
+
+ /**
+ *
+ * @param string $address
+ * @return \MessageSystems\SendGridCompatibility\Email
+ */
+ public function setFrom($address) {
+ $this->transmission->setFrom($address);
+ return $this;
+ }
+
+ /**
+ * TODO:figure this out
+ * @param string $name
+ */
+ public function setFromName($name) {
+
+ return $this;
+ }
+
+
+ /**
+ *
+ * @param string $address
+ * @return \MessageSystems\SendGridCompatibility\Email
+ */
+ public function setReplyTo($address) {
+ $this->transmission->setReplyTo($address);
+ return $this;
+ }
+
+ /**
+ * TODO: Does this work?
+ *
+ *
+ * @param string $address
+ * @return \MessageSystems\SendGridCompatibility\Email
+ */
+ public function addBcc($address) {
+ $this->transmission->addRecipient($address);
+ return $this;
+ }
+
+ public function setSubject($subject) {
+ $this->transmission->setSubject($subject);
+ return $this;
+ }
+
+ public function setText($text) {
+ $this->transmission->setTextContent($text);
+ return $this;
+ }
+
+ public function setHtml($html) {
+ $this->transmission->setHTMLContent($html);
+ return $this;
+ }
+}
+?> \ No newline at end of file
diff --git a/lib/MessageSystems/SendGridCompatibility/SDK.php b/lib/MessageSystems/SendGridCompatibility/SDK.php
new file mode 100644
index 0000000..f1a4df3
--- /dev/null
+++ b/lib/MessageSystems/SendGridCompatibility/SDK.php
@@ -0,0 +1,24 @@
+<?php
+namespace MessageSystems\SendGridCompatibility;
+
+use MessageSystems\Transmission;
+use MessageSystems\SendGridCompatibility\Email;
+use MessageSystems\Configuration;
+
+class SDK{
+ private $sparkPost;
+
+ public function __construct($username, $password, $options = null) {
+ //username isn't used in our system
+ $opts = ['key'=>$password];
+ if (!is_null($options)) {
+ $opts = array_merge($opts, $options);
+ }
+ Configuration::setConfig($opts);
+ }
+
+ public function send(Email $email) {
+ $email->send();
+ }
+}
+?> \ No newline at end of file