From 6847312778b6776e93ad126ff90d55be5ba7ea64 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sat, 22 Sep 2018 13:51:53 +0200 Subject: [PATCH] adding app/library/Mail.php --- app/library/Mail.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 app/library/Mail.php diff --git a/app/library/Mail.php b/app/library/Mail.php new file mode 100644 index 0000000..97a8c83 --- /dev/null +++ b/app/library/Mail.php @@ -0,0 +1,38 @@ +_sendgrid = $sendgrid; + } + + /** + * Send an email. + * + * @param string $subject + * @param string $to_address + * @param string $body + * @param string $content_type + */ + public function send($subject, $to_address, $body, $content_type = 'text/html') + { + $mail = new SendGridMail(); + $mail->setFrom('noreply@shufflingpixels.com'); + $mail->setSubject($subject); + $mail->addTo($to_address); + $mail->addContent($content_type, $body); + + $this->_sendgrid->send($mail); + } +}