<?php

use Neuron\Core\Template;
$app = (require __DIR__ . '/../bootstrap/start.php');
$mail = new \CatLab\Mailer\Models\Mail();
$mail->getImages()->add(__DIR__ . '/../images/logo.png');
$mail->getTo()->add('*****@*****.**');
$mail->setFrom('*****@*****.**');
$mail->setSubject('This is a test');
$mail->setTemplate(new Template('email/test.phpt', array('title' => 'Welcome to QuizWitz', 'message' => 'This message was sent at ' . date('d/m/Y H:i:s'))));
\CatLab\Mailer\Mailer::getInstance()->send($mail);
Example #2
0
<?php

$app = (require __DIR__ . '/../bootstrap/start.php');
$mail = new \CatLab\Mailer\Models\Mail();
$to = new \CatLab\Mailer\Collections\ContactCollection();
$to[] = '*****@*****.**';
$to[] = '*****@*****.**';
$mail->setTo($to);
$mail->setFrom('*****@*****.**');
$mail->setSubject('This is a test');
$mail->setText('This is an example text message.');
\CatLab\Mailer\Mailer::getInstance()->send($mail);
Example #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);
 }