/** * Generates the Laravel Message Object. * * @param Illuminate\Mail\Message $email * @param SimpleSoftwareIO\SMS\OutgoingMessage $message * * @return Illuminate\Mail\Message */ protected function generateMessage($email, $message) { foreach ($message->getToWithCarriers() as $number) { $email->to($this->buildEmail($number, $message)); } if ($message->getAttachImages()) { foreach ($message->getAttachImages() as $image) { $email->attach($image); } } $email->from($message->getFrom()); return $email; }
/** * Add the content to a given message. * * @param Illuminate\Mail\Message $message * @param string $view * @param string $plain * @param array $data * @return void */ protected function addContent($message, $view, $plain, $data) { if (isset($view)) { $message->setBody($this->getView($view, $data), 'text/html'); } if (isset($plain)) { $message->addPart($this->getView($plain, $data), 'text/plain'); } }
/** * Filters a Illuminate\Mail\Message and removes blocked recipients. * If no recipients remain, false is returned. Returns true if mailing * should proceed. * @param string $template * @param Illuminate\Mail\Message $message * @return bool */ public static function filterMessage($template, $message) { $recipients = $message->getTo(); $blockedAddresses = static::checkForEmail($template, $recipients); if (!count($blockedAddresses)) { return true; } foreach ($recipients as $address => $name) { if (in_array($address, $blockedAddresses)) { unset($recipients[$address]); } } $message->setTo($recipients); return count($recipients) ? true : false; }