Пример #1
0
 public function __construct(Mailer $mailer = null)
 {
     if (!isset($mailer)) {
         $mailer = Mailer::fromConfig();
     }
     $this->mailer = $mailer;
 }
Пример #2
0
<?php

// Initialize router
$router = new \Neuron\Router();
$mailer = \CatLab\Mailer\Mailer::fromConfig();
return $router;
Пример #3
0
 public static function sendMail($subject, $html, $email, $toName = "", $fromName = null, $fromEmail = null, $ccMyself = true, $isHtml = true)
 {
     $mailer = \CatLab\Mailer\Mailer::fromConfig();
     $mail = new \CatLab\Mailer\Models\Mail();
     if (defined('MAILER_FROM')) {
         $from = new \CatLab\Mailer\Models\Contact();
         $from->setEmail(MAILER_FROM);
         if ($fromName) {
             // Set name.
             $from->setName($fromName);
         }
         $mail->setFrom($from);
     }
     if (isset($fromEmail)) {
         $replyTo = new \CatLab\Mailer\Models\Contact();
         $replyTo->setEmail($fromEmail);
         if ($fromName) {
             $replyTo->setName($fromName);
         }
         $mail->setReplyTo($replyTo);
     }
     //$mail->ConfirmReadingTo = $myself->getEmail ();
     $to = $mail->getTo();
     $to[] = \CatLab\Mailer\Models\Contact::fromMixed($email)->setName($toName);
     if (isset($fromName) && isset($fromEmail) && $ccMyself) {
         $cc = $mail->getCc();
         $cc[] = \CatLab\Mailer\Models\Contact::fromMixed($fromEmail)->setName($fromEmail);
     }
     $mail->setSubject($subject);
     if ($isHtml) {
         $mail->setBody($html);
     } else {
         $mail->setText($html);
     }
     $mailer->send($mail);
 }