/
home
/
obinna
/
html
/
restaurants
/
src
/
Service
/
Upload File
HOME
<?php namespace App\Service; use Mailgun\Mailgun; /** * Mailgun transport class to handle transactional emails */ class MailgunTransport { private $api_key; private $domain; private $mailgun; public function __construct($mailgun_key, $mailgun_domain) { $this->api_key = $mailgun_key; $this->domain = $mailgun_domain; if ($this->mailgun === null) { $this->mailgun = Mailgun::create($this->api_key, 'https://api.eu.mailgun.net'); } return $this; } public function send($to, $subject, $message, $plain = null, $company = null) { $comp = $company ?: 'Cravvings'; $result = $this->mailgun->messages()->send($this->domain, array( 'from' => $comp . ' <no-reply@cravvings.com>', 'to' => $to, 'subject' => $subject, 'html' => $message )); return $result ? true : false; } }