/** * Send mail * * @param \CoreTyson\Mailer\Email $email Email instance. * @return void */ public function send(Email $email) { foreach ($email->recipients() as $mail => $name) { $this->_mail($mail, $email->subject(), $email->getContent(), $email->getHeaders()); } }
/** * Email constructor. * * Generate a boundary and init email */ public function __construct() { $this->_boundary = Email::generateBoundary(); $this->_headers['Mime-Version'] = 'Mime-Version: 1.0'; }
<?php use CoreTyson\Mailer\Email; use CoreTyson\Mailer\EmailMessage; use CoreTyson\Mailer\Mailer; $email = new Email(); $email->addRecipient('intelligide', '*****@*****.**')->setFrom('CoreTyson', '*****@*****.**')->setSubject('Mail Test')->addBc('*****@*****.**')->addBcc('*****@*****.**'); $plainTextMsg = new EmailMessage(); $plainTextMsg->setContent('Hello world')->setContentType('text/plain'); $attachment = new \CoreTyson\Mailer\Attachment("public/favicon.ico"); $email->addAttachment($attachment); $email->addMessage($plainTextMsg); Mailer::getSingleton()->send($email);