isMail() публичный Метод

Send messages using PHP's mail() function.
public isMail ( ) : void
Результат void
Пример #1
0
 public function init()
 {
     $this->_mailer = new \PHPMailer();
     switch ($this->method) {
         case 'smtp':
             $this->_mailer->isSMTP();
             $this->_mailer->Host = $this->smtp['host'];
             if (!empty($this->smtp['username'])) {
                 $this->_mailer->SMTPAuth = true;
                 $this->_mailer->Username = $this->smtp['username'];
                 $this->_mailer->Password = $this->smtp['password'];
             } else {
                 $this->_mailer->SMTPAuth = false;
             }
             if (isset($this->smtp['port'])) {
                 $this->_mailer->Port = $this->smtp['port'];
             }
             if (isset($this->smtp['secure'])) {
                 $this->_mailer->SMTPSecure = $this->smtp['secure'];
             }
             if (isset($this->smtp['debug'])) {
                 $this->_mailer->SMTPDebug = (int) $this->smtp['debug'];
             }
             break;
         case 'sendmail':
             $this->_mailer->isSendmail();
             break;
         default:
             $this->_mailer->isMail();
     }
     $this->_mailer->CharSet = \Yii::app()->charset;
     parent::init();
 }
 /**
  * Create the PHPMailer instance
  *
  * @return PHPMailer
  */
 private function createMailer()
 {
     $this->mailer = new PHPMailer(true);
     if ($this->attributes['smtp']) {
         $this->smtp();
     } elseif (array_get($this->attributes, 'sendmail')) {
         $this->mailer->isSendmail();
     } else {
         $this->mailer->isMail();
     }
     return $this->mailer;
 }
Пример #3
0
 public function postSaveadd()
 {
     $cre = ['name' => Input::get('name'), 'email' => Input::get('email'), 'enquiry' => Input::get('enquiry'), 'message' => Input::get('message')];
     $rules = ['name' => 'required', 'email' => 'required|email', 'enquiry' => 'required|not_in:0', 'message' => 'required'];
     $validator = Validator::make($cre, $rules);
     if ($validator->passes()) {
         require app_path() . '/mail.php';
         require app_path() . '/libraries/PHPMailerAutoload.php';
         $mail = new PHPMailer();
         $mail_text = new Mail();
         $mail->isMail();
         $mail->setFrom('*****@*****.**', 'Corper Life');
         $mail->addAddress('*****@*****.**');
         $mail->addAddress('*****@*****.**');
         $mail->isHTML(true);
         $mail->Subject = "Advertisement Request | Corper Life";
         $mail->Body = $mail_text->advert(Input::get("name"), Input::get("email"), Input::get("enquiry"), Input::get("phone"), Input::get("message"));
         if (!$mail->send()) {
             return Redirect::Back()->with('failure', 'Mailer Error: ' . $mail->ErrorInfo);
         } else {
             return Redirect::Back()->with('success', 'Your enquiry has been submitted. We will respond to it asap.');
         }
     } else {
         return Redirect::Back()->withErrors($validator)->withInput();
     }
 }
Пример #4
0
 static function init(&$doorGets)
 {
     $mail = null;
     if (!is_object($doorGets) || !is_array($doorGets->configWeb)) {
         return 'PHPMailerService: doorGets object not found';
     }
     $config = $doorGets->configWeb;
     $mail = new PHPMailer(true);
     $mail->CharSet = 'UTF-8';
     if ($config['smtp_mandrill_active']) {
         $mail->isSMTP();
         $mail->Host = $config['smtp_mandrill_host'];
         $mail->SMTPAuth = true;
         $mail->Username = $config['smtp_mandrill_username'];
         $mail->Password = $config['smtp_mandrill_password'];
         $mail->SMTPSecure = 'tls';
         if ($config['smtp_mandrill_ssl']) {
             $mail->SMTPSecure = 'ssl';
         }
         $mail->Port = (int) $config['smtp_mandrill_port'];
     } else {
         $mail->isMail();
     }
     $serverHost = $_SERVER['HTTP_HOST'];
     $mail->FromName = str_replace('www.', '', $serverHost);
     $serverName = $_SERVER['SERVER_NAME'];
     if ($serverName === '~^(?<vhost>.*)\\.doorgets\\.io$') {
         $serverName = 'doorgets.io';
     } else {
         $serverName = str_replace('www.', '', $serverName);
     }
     $mail->From = 'no-reply@' . $serverName;
     return $mail;
 }
Пример #5
0
function sendEmail($expediteur, $destinataires, $messageHTML, $objet = "", $attachmentEmail = "")
{
    global $thisSite;
    global $pathRacine;
    if ($expediteur == "") {
        return 0;
    }
    if ($destinataires == "") {
        return 0;
    }
    if (!is_array($destinataires)) {
        $destinataires = array($destinataires);
    }
    require_once $pathRacine . $thisSite->DOS_BASE_LIB . 'phpmailer/PHPMailerAutoload.php';
    $mail = new PHPMailer();
    if ($thisSite->MAIL_SENDMODE == "smtp") {
        $mail->isSMTP();
        //$mail->SMTPDebug = 2;
        //$mail->Debugoutput = 'html';
        $mail->Host = $thisSite->MAIL_HOST;
        //Set the hostname of the mail server
        $mail->Port = $thisSite->MAIL_PORT;
        //Set the SMTP port number - likely to be 25, 465 or 587
        $mail->SMTPAuth = $thisSite->SMTPAuth;
        //Whether to use SMTP authentication
        $mail->Username = $thisSite->MAIL_Username;
        //Username to use for SMTP authentication
        $mail->Password = $thisSite->MAIL_Password;
        //Password to use for SMTP authentication
    } else {
        if ($thisSite->MAIL_SENDMODE == "mail") {
            $mail->isMail();
        } else {
            if ($thisSite->MAIL_SENDMODE == "sendmail") {
                $mail->isSendmail();
            }
        }
    }
    $mail->From = $thisSite->MAIL_SENDER;
    $mail->addReplyTo($expediteur, $expediteur);
    $mail->From = $expediteur;
    $mail->FromName = '';
    foreach ($destinataires as $destinataire) {
        $mail->addAddress($destinataire);
    }
    $mail->isHTML(true);
    $mail->Subject = utf8_decode($objet);
    $mail->Body = utf8_decode($messageHTML);
    if (is_array($attachmentEmail)) {
        foreach ($attachmentEmail as $fichier) {
            $rr = $mail->addAttachment($fichier);
        }
    }
    if (!$mail->send()) {
        $res = $mail->ErrorInfo;
    } else {
        $res = true;
    }
    return $res;
}
Пример #6
0
 public function getMailer()
 {
     $mail = new PHPMailer(true);
     if ($this->config['isSMTP']) {
         $mail->SMTPDebug = $this->config['SMTPDebug'];
         // Enable verbose debug output
         $mail->isSMTP();
         // Set mailer to use SMTP
         $mail->Host = $this->config['Host'];
         // Specify main and backup SMTP servers
         $mail->SMTPAuth = $this->config['SMTPAuth'];
         // Enable SMTP authentication
         $mail->Username = $this->config['Username'];
         // SMTP username
         $mail->Password = $this->config['Password'];
         // SMTP password
         if (isset($this->config['SMTPSecure'])) {
             $mail->SMTPSecure = $this->config['SMTPSecure'];
             // Enable TLS encryption, `ssl` also accepted
         }
         $mail->Port = $this->config['Port'];
         // TCP port to connect to
         $mail->From = $this->config['From'];
         $mail->FromName = $this->config['FromName'];
     } else {
         $mail->From = $this->config['From'];
         $mail->FromName = $this->config['FromName'];
         $mail->isMail();
     }
     return $mail;
 }
 /**
  * creates a new phpmailer object
  */
 protected function initMailer()
 {
     $mail = new PHPMailer();
     $mail->isMail();
     if ($this->charset) {
         $mail->CharSet = $this->charset;
     }
     return $mail;
 }
Пример #8
0
 public function execute($_options = null)
 {
     $eqLogic = $this->getEqLogic();
     if ($_options === null) {
         throw new Exception('[Mail] Les options de la fonction ne peuvent etre null');
     }
     if ($_options['message'] == '' && $_options['title'] == '') {
         throw new Exception('[Mail] Le message et le sujet ne peuvent être vide');
         return false;
     }
     if ($_options['title'] == '') {
         $_options['title'] = '[Jeedom] - Notification';
     }
     $mail = new PHPMailer(true);
     //PHPMailer instance with exceptions enabled
     $mail->CharSet = 'utf-8';
     $mail->SMTPDebug = 0;
     switch ($eqLogic->getConfiguration('sendMode', 'mail')) {
         case 'smtp':
             $mail->isSMTP();
             $mail->Host = $eqLogic->getConfiguration('smtp::server');
             $mail->Port = (int) $eqLogic->getConfiguration('smtp::port');
             $mail->SMTPSecure = $eqLogic->getConfiguration('smtp::security');
             if ($eqLogic->getConfiguration('smtp::username') != '') {
                 $mail->SMTPAuth = true;
                 $mail->Username = $eqLogic->getConfiguration('smtp::username');
                 // SMTP account username
                 $mail->Password = $eqLogic->getConfiguration('smtp::password');
                 // SMTP account password
             }
             break;
         case 'mail':
             $mail->isMail();
             break;
         case 'sendmail':
             $mail->isSendmail();
         case 'qmail':
             $mail->isQmail();
             break;
         default:
             throw new Exception('Mode d\'envoi non reconnu');
     }
     if ($eqLogic->getConfiguration('fromName') != '') {
         $mail->addReplyTo($eqLogic->getConfiguration('fromMail'), $eqLogic->getConfiguration('fromName'));
         $mail->FromName = $eqLogic->getConfiguration('fromName');
     } else {
         $mail->addReplyTo($eqLogic->getConfiguration('fromMail'));
         $mail->FromName = $eqLogic->getConfiguration('fromMail');
     }
     $mail->From = $eqLogic->getConfiguration('fromMail');
     $mail->addAddress($this->getConfiguration('recipient'));
     $mail->Subject = $_options['title'];
     $mail->msgHTML(htmlentities($_options['message']), dirname(__FILE__), true);
     return $mail->send();
 }
Пример #9
0
 /**
  * Miscellaneous calls to improve test coverage and some small tests.
  */
 public function testMiscellaneous()
 {
     $this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
     $this->Mail->addCustomHeader('SomeHeader: Some Value');
     $this->Mail->clearCustomHeaders();
     $this->Mail->clearAttachments();
     $this->Mail->isHTML(false);
     $this->Mail->isSMTP();
     $this->Mail->isMail();
     $this->Mail->isSendmail();
     $this->Mail->isQmail();
     $this->Mail->setLanguage('fr');
     $this->Mail->Sender = '';
     $this->Mail->createHeader();
     $this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
     $this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
     $this->assertTrue($this->Mail->set('AllowEmpty', null), 'Null property set failed');
     $this->assertTrue($this->Mail->set('AllowEmpty', false), 'Valid property set of null property failed');
     //Test pathinfo
     $a = '/mnt/files/飛兒樂 團光茫.mp3';
     $q = PHPMailer::mb_pathinfo($a);
     $this->assertEquals($q['dirname'], '/mnt/files', 'UNIX dirname not matched');
     $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'UNIX basename not matched');
     $this->assertEquals($q['extension'], 'mp3', 'UNIX extension not matched');
     $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'UNIX filename not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, PATHINFO_DIRNAME), '/mnt/files', 'Dirname path element not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, PATHINFO_BASENAME), '飛兒樂 團光茫.mp3', 'Basename path element not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, 'filename'), '飛兒樂 團光茫', 'Filename path element not matched');
     $a = 'c:\\mnt\\files\\飛兒樂 團光茫.mp3';
     $q = PHPMailer::mb_pathinfo($a);
     $this->assertEquals($q['dirname'], 'c:\\mnt\\files', 'Windows dirname not matched');
     $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'Windows basename not matched');
     $this->assertEquals($q['extension'], 'mp3', 'Windows extension not matched');
     $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'Windows filename not matched');
     $this->assertEquals(PHPMailer::filenameToType('abc.jpg?xyz=1'), 'image/jpeg', 'Query string not ignored in filename');
     $this->assertEquals(PHPMailer::filenameToType('abc.xyzpdq'), 'application/octet-stream', 'Default MIME type not applied to unknown extension');
     //Line break normalization
     $eol = $this->Mail->LE;
     $b1 = "1\r2\r3\r";
     $b2 = "1\n2\n3\n";
     $b3 = "1\r\n2\r3\n";
     $this->Mail->LE = "\n";
     $t1 = "1{$this->Mail->LE}2{$this->Mail->LE}3{$this->Mail->LE}";
     $this->assertEquals($this->Mail->fixEOL($b1), $t1, 'Failed to normalize line breaks (1)');
     $this->assertEquals($this->Mail->fixEOL($b2), $t1, 'Failed to normalize line breaks (2)');
     $this->assertEquals($this->Mail->fixEOL($b3), $t1, 'Failed to normalize line breaks (3)');
     $this->Mail->LE = "\r\n";
     $t1 = "1{$this->Mail->LE}2{$this->Mail->LE}3{$this->Mail->LE}";
     $this->assertEquals($this->Mail->fixEOL($b1), $t1, 'Failed to normalize line breaks (4)');
     $this->assertEquals($this->Mail->fixEOL($b2), $t1, 'Failed to normalize line breaks (5)');
     $this->assertEquals($this->Mail->fixEOL($b3), $t1, 'Failed to normalize line breaks (6)');
     $this->Mail->LE = $eol;
 }
Пример #10
0
 public static function send($to, $subject, $params = array(), $vars = array())
 {
     global $LANG;
     if (empty($params['template'])) {
         if (empty($params['message'])) {
             return false;
         } else {
             $text = $params['message'];
         }
     } else {
         if (!file_exists((isset($params['path']) ? $params['path'] : '') . TMAIL_LOCATION . '/' . $params['template'] . '.html')) {
             return false;
         }
         $text = file_get_contents((isset($params['path']) ? $params['path'] : '') . TMAIL_LOCATION . '/' . $params['template'] . '.html');
         extract($vars);
         eval("\$text = \"{$text}\";");
     }
     include (isset($params['path']) ? $params['path'] : '') . LBDIR . '/PHPMailer/class.phpmailer.php';
     $mail = new \PHPMailer();
     $mail->CharSet = 'UTF-8';
     $mail->AddReplyTo(isset($params['reply_to']) ? $params['reply_to'] : \query\main::get_option('email_answer_to'), isset($params['reply_name']) ? $params['reply_name'] : '');
     $mail->From = isset($params['from_name']) ? $params['from_name'] : \query\main::get_option('email_answer_to');
     $mail->FromName = isset($params['from_email']) ? $params['from_email'] : \query\main::get_option('email_from_name');
     $mail->AddAddress($to);
     $mail->Subject = $subject;
     $mail->MsgHTML($text);
     $mail->IsHTML(true);
     switch (\query\main::get_option('mail_method')) {
         case 'SMTP':
             $mail->IsSMTP();
             // tell the class to use SMTP
             $mail->SMTPAuth = \query\main::get_option('smtp_auth');
             $mail->Port = \query\main::get_option('smtp_port');
             $mail->Host = \query\main::get_option('smtp_host');
             $mail->Username = \query\main::get_option('smtp_user');
             $mail->Password = \query\main::get_option('smtp_password');
             break;
         case 'sendmail':
             $mail->isSendmail();
             $mail->Sendmail = \query\main::get_option('sendmail_path');
             break;
         default:
             $mail->isMail();
             break;
     }
     if ($mail->Send()) {
         return true;
     } else {
         return false;
     }
 }
Пример #11
0
 private function send()
 {
     $mail = new PHPMailer();
     if (!empty($this->config->mailer)) {
         //$mail->SMTPDebug = 3;                               // Enable verbose debug output
         $mail->isSMTP();
         // Set mailer to use SMTP
         $mail->Host = $this->config->mailer->Host;
         // Specify main and backup SMTP servers
         $mail->SMTPAuth = $this->config->mailer->SMTPAuth;
         // Enable SMTP authentication
         $mail->Username = $this->config->mailer->Username;
         // SMTP username
         $mail->Password = $this->config->mailer->Password;
         // SMTP password
         if (isset($this->config->mailer->SMTPSecure)) {
             $mail->SMTPSecure = $this->config->mailer->SMTPSecure;
             // Enable TLS encryption, `ssl` also accepted
         }
         $mail->Port = $this->config->mailer->Port;
         // TCP port to connect to
         $mail->From = $this->config->mailer->From;
         $mail->FromName = $this->config->mailer->FromName;
     } else {
         $mail->From = $this->from;
         $mail->FromName = $this->config->site->titulo;
         $mail->isMail();
     }
     if (!empty($this->replyTo)) {
         $mail->addReplyTo($this->replyTo);
     }
     $mail->addAddress($this->to);
     // Add a recipient
     $mail->addReplyTo($this->to);
     $mail->CharSet = 'UTF-8';
     $mail->isHTML(true);
     // Set email format to HTML
     $mail->Subject = $this->subject;
     $mail->Body = $this->message;
     if (!$mail->send()) {
         if (true == $this->config->debug) {
             die('Mailer Error: ' . $mail->ErrorInfo);
         }
         return false;
     } else {
         return true;
     }
 }
Пример #12
0
 /**
  * Constructor.
  */
 function __construct()
 {
     require_once PHPMAILER_CLASS;
     require_once PHPMAILER_SMTP;
     require_once PHPMAILER_POP3;
     // Inicializa la instancia PHPMailer.
     $mail = new \PHPMailer();
     // Define  el idioma para los mensajes de error.
     $mail->SetLanguage("es", PHPMAILER_LANGS);
     // Define la codificación de caracteres del mensaje.
     $mail->CharSet = "UTF-8";
     // Define el ajuste de texto a un número determinado de caracteres en el cuerpo del mensaje.
     $mail->WordWrap = 50;
     // Define el tipo de gestor de correo
     switch (GOTEO_MAIL_TYPE) {
         default:
         case "mail":
             $mail->isMail();
             // set mailer to use PHP mail() function.
             break;
         case "sendmail":
             $mail->IsSendmail();
             // set mailer to use $Sendmail program.
             break;
         case "qmail":
             $mail->IsQmail();
             // set mailer to use qmail MTA.
             break;
         case "smtp":
             $mail->IsSMTP();
             // set mailer to use SMTP
             $mail->SMTPAuth = GOTEO_MAIL_SMTP_AUTH;
             // enable SMTP authentication
             $mail->SMTPSecure = GOTEO_MAIL_SMTP_SECURE;
             // sets the prefix to the servier
             $mail->Host = GOTEO_MAIL_SMTP_HOST;
             // specify main and backup server
             $mail->Port = GOTEO_MAIL_SMTP_PORT;
             // set the SMTP port
             $mail->Username = GOTEO_MAIL_SMTP_USERNAME;
             // SMTP username
             $mail->Password = GOTEO_MAIL_SMTP_PASSWORD;
             // SMTP password
             break;
     }
     $this->mail = $mail;
 }
Пример #13
0
 protected function chose_sender_strategy()
 {
     switch ($this->method) {
         case Mailer::MAIL:
             $this->php_mailer->isMail();
             break;
         case Mailer::QMAIL:
             $this->php_mailer->isQmail();
             break;
         case Mailer::SEND_MAIL:
             $this->php_mailer->isSendmail();
             break;
         default:
             $this->php_mailer->isSMTP();
             $this->method = Mailer::SMTP;
     }
 }
Пример #14
0
 public static function mailWrapper($to, $subject = '(No subject)', $message = '', $aImagesToEmbed = [], $aFilesToAttach = [])
 {
     $mail = new \PHPMailer();
     $mail->CharSet = 'UTF-8';
     $mail->isMail();
     if (HelperConfig::$core['mail_method'] == 'sendmail') {
         $mail->isSendmail();
     } elseif (HelperConfig::$core['mail_method'] == 'smtp') {
         $mail->isSMTP();
         $mail->Host = HelperConfig::$secrets['mail_smtp_server'];
         $mail->Port = HelperConfig::$secrets['mail_smtp_port'];
         if (HelperConfig::$secrets['mail_smtp_auth'] == true) {
             $mail->SMTPAuth = true;
             $mail->Username = HelperConfig::$secrets['mail_smtp_auth_user'];
             $mail->Password = HelperConfig::$secrets['mail_smtp_auth_pwd'];
             if (HelperConfig::$secrets['mail_smtp_secure']) {
                 $mail->SMTPSecure = 'tls';
                 if (HelperConfig::$secrets['mail_smtp_secure_method'] == 'ssl') {
                     $mail->SMTPSecure = 'ssl';
                 }
             }
         }
     }
     $mail->From = HelperConfig::$core["email_sender"];
     $mail->FromName = HelperConfig::$core["email_sendername"];
     $mail->addAddress($to);
     $mail->isHTML(true);
     $mail->Subject = $subject;
     $mail->Body = $message;
     if (is_array($aImagesToEmbed) && count($aImagesToEmbed)) {
         foreach ($aImagesToEmbed as $sKey => $imgdata) {
             $imginfo = getimagesizefromstring($imgdata['binimg']);
             $mail->addStringEmbeddedImage($imgdata['binimg'], $sKey, $sKey, 'base64', $imginfo['mime']);
         }
     }
     if (is_array($aFilesToAttach) && count($aFilesToAttach)) {
         foreach ($aFilesToAttach as $sValue) {
             if (file_exists($sValue)) {
                 $mail->addAttachment($sValue);
             }
         }
     }
     //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
     return $mail->send();
 }
Пример #15
0
 /**
  * Send message
  *
  * @param string $subject     Subject
  * @param array  $from        From
  * @param array  $to          To
  * @param string $body        Body
  * @param string $attachment  Attachment Path
  *
  * @return void
  */
 public function send($subject, array $from, array $to, $body, $attachment = '')
 {
     $phpMailer = new \PHPMailer();
     $phpMailer->isHTML();
     $phpMailer->isMail();
     $phpMailer->Priority = 1;
     $phpMailer->UseSendmailOptions = false;
     $phpMailer->setFrom($from['email'], $from['name']);
     $phpMailer->addReplyTo($from['email'], $from['name']);
     foreach ($to as $toItem) {
         $phpMailer->AddAddress($toItem['email'], $toItem['name']);
     }
     $phpMailer->Subject = $subject;
     $phpMailer->msgHTML($body);
     if ($attachment) {
         $phpMailer->addAttachment($attachment);
     }
     $phpMailer->send();
 }
Пример #16
0
function send_drug_email($subject, $body)
{
    $recipient = $GLOBALS['practice_return_email_path'];
    if (empty($recipient)) {
        return;
    }
    $mail = new PHPMailer();
    $mail->From = $recipient;
    $mail->FromName = 'In-House Pharmacy';
    $mail->isMail();
    $mail->Host = "localhost";
    $mail->Mailer = "mail";
    $mail->Body = $body;
    $mail->Subject = $subject;
    $mail->AddAddress($recipient);
    if (!$mail->Send()) {
        error_log("There has been a mail error sending to " . $recipient . " " . $mail->ErrorInfo);
    }
}
Пример #17
0
function email($to, $msg, $subject)
{
    require_once '../plugins/PHPMailer-master/PHPMailerAutoload.php';
    $mail = new PHPMailer();
    $mail->isMail();
    $mail->From = '*****@*****.**';
    $mail->FromName = 'Ruben und Jannes';
    $mail->addAddress($to);
    //$mail->addBCC('*****@*****.**');
    $mail->Subject = $subject;
    $mail->Body = $msg;
    $mail->AltBody = $msg;
    if (!$mail->send()) {
        $echo = 'Message could not be sent.';
        $echo .= 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
        $echo = 'Message has been sent';
    }
    return $echo;
}
Пример #18
0
function send_drug_email($subject, $body)
{
    require_once $GLOBALS['srcdir'] . "/classes/class.phpmailer.php";
    $recipient = $GLOBALS['practice_return_email_path'];
    if (empty($recipient)) {
        return;
    }
    $mail = new PHPMailer();
    $mail->SetLanguage("en", $GLOBALS['fileroot'] . "/library/");
    $mail->From = $recipient;
    $mail->FromName = 'In-House Pharmacy';
    $mail->isMail();
    $mail->Host = "localhost";
    $mail->Mailer = "mail";
    $mail->Body = $body;
    $mail->Subject = $subject;
    $mail->AddAddress($recipient);
    if (!$mail->Send()) {
        error_log("There has been a mail error sending to " . $recipient . " " . $mail->ErrorInfo);
    }
}
Пример #19
0
 /**
  * @param string $EventName
  * @todo add port settings
  * @return boolean
  */
 public function send($EventName = '')
 {
     $this->formatMessage($this->emailTemplate->toString());
     $this->fireEvent('BeforeSendMail');
     if (c('Garden.Email.Disabled')) {
         throw new Exception('Email disabled', self::ERR_SKIPPED);
     }
     if (c('Garden.Email.UseSmtp')) {
         $this->PhpMailer->isSMTP();
         $SmtpHost = c('Garden.Email.SmtpHost', '');
         $SmtpPort = c('Garden.Email.SmtpPort', 25);
         if (strpos($SmtpHost, ':') !== false) {
             list($SmtpHost, $SmtpPort) = explode(':', $SmtpHost);
         }
         $this->PhpMailer->Host = $SmtpHost;
         $this->PhpMailer->Port = $SmtpPort;
         $this->PhpMailer->SMTPSecure = c('Garden.Email.SmtpSecurity', '');
         $this->PhpMailer->Username = $Username = c('Garden.Email.SmtpUser', '');
         $this->PhpMailer->Password = $Password = c('Garden.Email.SmtpPassword', '');
         if (!empty($Username)) {
             $this->PhpMailer->SMTPAuth = true;
         }
     } else {
         $this->PhpMailer->isMail();
     }
     if ($EventName != '') {
         $this->EventArguments['EventName'] = $EventName;
         $this->fireEvent('SendMail');
     }
     if (!empty($this->Skipped) && count($this->PhpMailer->getAllRecipientAddresses()) == 0) {
         // We've skipped all recipients.
         throw new Exception('No valid email recipients.', self::ERR_SKIPPED);
     }
     $this->PhpMailer->setThrowExceptions(true);
     if (!$this->PhpMailer->send()) {
         throw new Exception($this->PhpMailer->ErrorInfo);
     }
     return true;
 }
Пример #20
0
 /**
  * @todo add port settings
  */
 public function send($EventName = '')
 {
     $this->fireEvent('BeforeSendMail');
     if (c('Garden.Email.Disabled')) {
         return;
     }
     if (c('Garden.Email.UseSmtp')) {
         $this->PhpMailer->isSMTP();
         $SmtpHost = c('Garden.Email.SmtpHost', '');
         $SmtpPort = c('Garden.Email.SmtpPort', 25);
         if (strpos($SmtpHost, ':') !== false) {
             list($SmtpHost, $SmtpPort) = explode(':', $SmtpHost);
         }
         $this->PhpMailer->Host = $SmtpHost;
         $this->PhpMailer->Port = $SmtpPort;
         $this->PhpMailer->SMTPSecure = c('Garden.Email.SmtpSecurity', '');
         $this->PhpMailer->Username = $Username = c('Garden.Email.SmtpUser', '');
         $this->PhpMailer->Password = $Password = c('Garden.Email.SmtpPassword', '');
         if (!empty($Username)) {
             $this->PhpMailer->SMTPAuth = true;
         }
     } else {
         $this->PhpMailer->isMail();
     }
     if ($EventName != '') {
         $this->EventArguments['EventName'] = $EventName;
         $this->fireEvent('SendMail');
     }
     if (!empty($this->Skipped) && $this->PhpMailer->countRecipients() == 0) {
         // We've skipped all recipients.
         return true;
     }
     $this->PhpMailer->throwExceptions(true);
     if (!$this->PhpMailer->send()) {
         throw new Exception($this->PhpMailer->ErrorInfo);
     }
     return true;
 }
Пример #21
0
function sendEmail($subject, $body, $from, $to)
{
    require_once APP_PATH . 'helpers/PHPMailer-master/class.phpmailer.php';
    $mail = new PHPMailer();
    $mail->isSMTP();
    $mail->SMTPDebug = 2;
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = 'ssl';
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 465;
    $mail->isMail(true);
    $mail->Username = '******';
    $mail->Password = '******';
    $mail->setFrom($from);
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->addAddress($to);
    if ($mail->send()) {
        return true;
    } else {
        return false;
    }
}
Пример #22
0
function send_mail($name, $email, $pixelid, $password)
{
    include "phpmailer/PHPMailerAutoload.php";
    $mail = new PHPMailer();
    $mail->isMail();
    $mail->Host = 'mail.pixel2k16.in';
    $mail->Port = 587;
    $mail->SMTPAuth = true;
    // $mail->SMTPDebug = 2;
    $mail->Username = "******";
    // SMTP username
    $mail->Password = "******";
    // SMTP password
    $webmaster_email = "*****@*****.**";
    //Reply to this email ID
    $mail->From = "*****@*****.**";
    $mail->FromName = "Team Pixel";
    $mail->AddReplyTo($webmaster_email, "PIXEL2K16");
    $mail->WordWrap = 50;
    // set word wrap
    // $noimg = "http://avc.host-ed.me/pixel2k16seen.php?s=".$to."&sub=forgotpassword";
    $mail->IsHTML(true);
    // send as HTML
    $mail->Subject = "PIXEL - 2K16 Registration";
    $mail->Body = "<pre style='font-size:1.1em; color:#000000; font-family: calibri; '> \r\n        Hello " . $name . ",\r\n\r\n          Thanks for Registering for PIXEL-2K16. We will be in touch.\r\n\r\n          Your PIXEL - 2K16 CREDENTIALS:\r\n                    \r\n            <b>Pixel ID :</b> " . $pixelid . "            \r\n            <b>Password </b>: " . $password . "\r\n\r\n          <a href='http://pixel2k16.in' target='_blank'>Click here</a> to enter PIXEL - 2K16\r\n\r\n          With Regards,\r\n          Pixel - 2K16.\r\n      </pre>\r\n       \r\n        ";
    //HTML Body
    $mail->AltBody = "Registration details for PIXEL2K16";
    //Text Body
    $mail->AddAddress($email, '');
    $msg = "";
    if (!$mail->Send()) {
        $msg = "notsent";
    } else {
        $msg = "sent";
    }
    return $msg;
}
Пример #23
0
 function sendMailer($email_to, $email_from, $email_reply, $email_name, $subject, $message, $is_test = false)
 {
     global $DOPBSP;
     $php_mailer = new PHPMailer();
     $php_mailer->CharSet = 'utf-8';
     $php_mailer->isMail();
     $emails_to = explode(',', $email_to);
     for ($i = 0; $i < count($emails_to); $i++) {
         $php_mailer->addAddress($emails_to[$i]);
     }
     $php_mailer->From = $email_from;
     $php_mailer->FromName = $email_name;
     $php_mailer->addReplyTo($email_reply);
     $php_mailer->isHTML(true);
     $php_mailer->Subject = $subject;
     $php_mailer->Body = $message;
     if (!$php_mailer->send()) {
         if ($is_test) {
             echo $DOPBSP->text('SETTINGS_NOTIFICATIONS_TEST_ERROR') . '<br />';
             echo 'Mailer error: ' . $php_mailer->ErrorInfo . '<br />';
             echo $php_mailer->ErrorInfo;
             die;
         } else {
             $this->sendWPMail($email_to, $email_from, $email_reply, $email_name, $subject, $message);
         }
     } else {
         if ($is_test) {
             echo 'success';
             die;
         }
     }
 }
Пример #24
0
function callbackAction($result, $to, $cc, $bcc, $subject, $body)
{
    /*
    this callback example echos the results to the screen - implement to
    post to databases, build CSV log files, etc., with minor changes
    */
    $to = cleanEmails($to, 'to');
    $cc = cleanEmails($cc[0], 'cc');
    $bcc = cleanEmails($bcc[0], 'cc');
    echo $result . "\tTo: " . $to['Name'] . "\tTo: " . $to['Email'] . "\tCc: " . $cc['Name'] . "\tCc: " . $cc['Email'] . "\tBcc: " . $bcc['Name'] . "\tBcc: " . $bcc['Email'] . "\t" . $subject . "\n\n" . $body . "\n";
    return true;
}
require_once '../class.phpmailer.php';
$mail = new PHPMailer();
try {
    $mail->isMail();
    $mail->setFrom('*****@*****.**', 'Your Name');
    $mail->addAddress('*****@*****.**', 'John Doe');
    $mail->Subject = 'PHPMailer Lite Test Subject via mail()';
    // optional - msgHTML will create an alternate automatically
    $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
    $mail->msgHTML(file_get_contents('../examples/contents.html'));
    $mail->addAttachment('../examples/images/phpmailer.png');
    // attachment
    $mail->addAttachment('../examples/images/phpmailer_mini.gif');
    // attachment
    $mail->action_function = 'callbackAction';
    $mail->send();
    echo "Message Sent OK</p>\n";
} catch (phpmailerException $e) {
    echo $e->errorMessage();
Пример #25
0
$taxes = $total - $subtotal;
db_execute('insert into siteinvoice_invoice (id, client_id, name, sent_on, status, notice, subtotal, taxes, total, currency) values (null, ?, ?, now(), "unpaid", 0, ?, ?, ?, ?)', $cgi->client, $cgi->name, $subtotal, $taxes, $total, $cgi->currency);
$invoice_id = db_lastid();
$pdf->Output('inc/app/siteinvoice/data/' . $invoice_id . '.pdf');
umask(00);
chmod('inc/app/siteinvoice/data/' . $invoice_id . '.pdf', 0777);
if ($cgi->send_invoice == 'yes') {
    // get client info
    $client = db_single('select * from siteinvoice_client where id = ?', $cgi->client);
    $client->invoice_no = $invoice_id;
    $client->total = $total;
    $client->currency = $cgi->currency;
    // send email to client
    loader_import('ext.phpmailer');
    $mailer = new PHPMailer();
    $mailer->isMail();
    $mailer->From = appconf('company_email');
    $mailer->FromName = appconf('company_email_name');
    $mailer->Subject = 'Invoice #' . $invoice_id;
    $mailer->Body = template_simple('email/initial.spt', $client);
    $mailer->AddAttachment('inc/app/siteinvoice/data/' . $invoice_id . '.pdf', strtolower($client->code) . '-' . $invoice_id . '.pdf');
    $mailer->AddAddress($client->contact_email, $client->contact_name);
    $bcc_list = appconf('bcc_list');
    if (!empty($bcc_list)) {
        $bcc = appconf('company_email') . ', ' . $bcc_list;
    } else {
        $bcc = appconf('company_email');
    }
    $mailer->AddBCC($bcc);
    $mailer->Send();
    // reply on screen
Пример #26
0
    /**
     * Send an email using a Transactional email service
     * or native PHP as a fallback.
     *
     * @param array  $attributes  A list of attributes for sending
     * @return bool on success
     */
    public static function send($attributes = array())
    {
        /*
        |--------------------------------------------------------------------------
        | Required attributes
        |--------------------------------------------------------------------------
        |
        | We first need to ensure we have the minimum fields necessary to send
        | an email.
        |
        */
        $required = array_intersect_key($attributes, array_flip(self::$required));

        if (count($required) >= 3) {

            /*
            |--------------------------------------------------------------------------
            | Load handler from config
            |--------------------------------------------------------------------------
            |
            | We check the passed data for a mailer + key first, and then fall back
            | to the global Statamic config.
            |
            */
            $email_handler     = array_get($attributes, 'email_handler', Config::get('email_handler', null));
            $email_handler_key = array_get($attributes, 'email_handler_key', Config::get('email_handler_key', null));

            if (in_array($email_handler, self::$email_handlers) && $email_handler_key) {

                /*
                |--------------------------------------------------------------------------
                | Initialize Stampie
                |--------------------------------------------------------------------------
                |
                | Stampie provides numerous adapters for popular email handlers, such as
                | Mandrill, Postmark, and SendGrid. Each is written as an abstract
                | interface in an Adapter Pattern.
                |
                */
                $mailer = self::initializeEmailHandler($email_handler, $email_handler_key);

                /*
                |--------------------------------------------------------------------------
                | Initialize Message class
                |--------------------------------------------------------------------------
                |
                | The message class is an implementation of the Stampie MessageInterface
                |
                */
                $email = new Message($attributes['to']);

                /*
                |--------------------------------------------------------------------------
                | Set email attributes
                |--------------------------------------------------------------------------
                |
                | I hardly think this requires much explanation.
                |
                */
                $email->setFrom($attributes['from']);

                $email->setSubject($attributes['subject']);

                if (isset($attributes['text'])) {
                    $email->setText($attributes['text']);
                }

                if (isset($attributes['html'])) {
                    $email->setHtml($attributes['html']);
                }

                if (isset($attributes['cc'])) {
                    $email->setCc($attributes['cc']);
                }

                if (isset($attributes['bcc'])) {
                    $email->setBcc($attributes['bcc']);
                }

                if (isset($attributes['headers'])) {
                    $email->setHeaders($attributes['headers']);
                }

                $mailer->send($email);

                return true;

            } else {

                /*
                |--------------------------------------------------------------------------
                | Native PHP Mail
                |--------------------------------------------------------------------------
                |
                | We're utilizing the popular PHPMailer class to handle the messy
                | email headers and do-dads. Emailing from PHP in general isn't the best
                | idea known to man, so this is really a lackluster fallback.
                |
                */
            try {
                $email = new PHPMailer(true);

                // SMTP
                if ($attributes['smtp'] = array_get($attributes, 'smtp', Config::get('smtp'))) {
                    
                    $email->isSMTP();

                    if ($smtp_host = array_get($attributes, 'smtp:host', false)) {
                        $email->Host = $smtp_host;
                    }

                    if ($smtp_secure = array_get($attributes, 'smtp:secure', false)) {
                        $email->SMTPSecure = $smtp_secure;
                    }

                    if ($smtp_port = array_get($attributes, 'smtp:port', false)) {
                        $email->Port = $smtp_port;
                    }

                    if (array_get($attributes, 'smtp:auth', false) === TRUE) {
                        $email->SMTPAuth = TRUE;
                    }

                    if ($smtp_username = array_get($attributes, 'smtp:username', false)) {
                        $email->Username = $smtp_username;
                    }

                    if ($smtp_password = array_get($attributes, 'smtp:password', false)) {
                        $email->Password = $smtp_password;
                    }

                // SENDMAIL
                } elseif (array_get($attributes, 'sendmail', false)) {
                    $email->isSendmail();

                // PHP MAIL
                } else {
                    $email->isMail();
                }

                $email->CharSet = 'UTF-8';

                $from_parts = self::explodeEmailString($attributes['from']);
                $email->setFrom($from_parts['email'], $from_parts['name']);

                $to = Helper::ensureArray($attributes['to']);
                foreach ($to as $to_addr) {
                    $to_parts = self::explodeEmailString($to_addr);
                    $email->addAddress($to_parts['email'], $to_parts['name']);
                }

                $email->Subject  = $attributes['subject'];

                if (isset($attributes['html'])) {
                    $email->msgHTML($attributes['html']);

                    if (isset($attributes['text'])) {
                        $email->AltBody = $attributes['text'];
                    }

                } elseif (isset($attributes['text'])) {
                    $email->msgHTML($attributes['text']);
                }

                if (isset($attributes['cc'])) {
                    $cc = Helper::ensureArray($attributes['cc']);
                    foreach ($cc as $cc_addr) {
                        $cc_parts = self::explodeEmailString($cc_addr);
                        $email->addCC($cc_parts['email'], $cc_parts['name']);
                    }                    
                }

                if (isset($attributes['bcc'])) {
                    $bcc = Helper::ensureArray($attributes['bcc']);
                    foreach ($bcc as $bcc_addr) {
                        $bcc_parts = self::explodeEmailString($bcc_addr);
                        $email->addBCC($bcc_parts['email'], $bcc_parts['name']);
                    }      
                }

                $email->send();

                } catch (phpmailerException $e) {
                    echo $e->errorMessage(); //error messages from PHPMailer
                    Log::error($e->errorMessage(), 'core', 'email');
                } catch (Exception $e) {
                    echo $e->getMessage();
                    Log::error($e->getMessage(), 'core', 'email');
                }

            }
        }

        return false;
    }
 function _email_prescription($p, $email)
 {
     if (empty($email)) {
         $this->assign("process_result", "Email could not be sent, the address supplied: '{$email}' was empty or invalid.");
         return;
     }
     require $GLOBALS['fileroot'] . "/library/classes/class.phpmailer.php";
     $mail = new PHPMailer();
     $mail->SetLanguage("en", $GLOBALS['fileroot'] . "/library/");
     //this is a temporary config item until the rest of the per practice billing settings make their way in
     $mail->From = $GLOBALS['practice_return_email_path'];
     $mail->FromName = $p->provider->get_name_display();
     $mail->isMail();
     $mail->Host = "localhost";
     $mail->Mailer = "mail";
     $text_body = $p->get_prescription_display();
     $mail->Body = $text_body;
     $mail->Subject = "Prescription for: " . $p->patient->get_name_display();
     $mail->AddAddress($email);
     if ($mail->Send()) {
         $this->assign("process_result", "Email was successfully sent to: " . $email);
         return;
     } else {
         $this->assign("process_result", "There has been a mail error sending to " . $_POST['email_to'] . " " . $mail->ErrorInfo);
         return;
     }
 }
Пример #28
0
 function save()
 {
     $resources = MALETEKPL__PLUGIN_URL . 'resources/';
     $result = array('message' => array(), 'status' => 'error');
     $this->DB->select(WP_PREFIX . 'maletek_pintalocker_item', 'varName ASC');
     $items = $this->DB->get('array');
     $itemList = array();
     foreach ($items as $c) {
         $itemList[$c['id']] = $c['varName'];
     }
     foreach ($_POST as $key => $value) {
         switch ($key) {
             case 'idItem':
                 if (!filter_var($value, FILTER_VALIDATE_INT) || !array_key_exists($value, $itemList)) {
                     $result['message'][] = '* Modelo inválido';
                 }
                 break;
             case 'varBusiness':
                 break;
             case 'varContent':
                 if (empty($value)) {
                     //$result['message'][]='* Configuración inválida';
                 }
                 break;
             case 'varEmail':
                 if (empty($value) || !filter_var($value, FILTER_VALIDATE_EMAIL)) {
                     $result['message'][] = '* Email inválido';
                 }
                 break;
             case 'varLastName':
                 if (empty($value)) {
                     $result['message'][] = '* Apellidos inválidos';
                 }
                 break;
             case 'varName':
                 if (empty($value)) {
                     $result['message'][] = '* Nombres inválidos';
                 }
                 break;
             case 'varPhone':
                 if (empty($value) || !filter_var($value, FILTER_VALIDATE_INT)) {
                     $result['message'][] = '* Telefono inválido';
                 }
                 break;
         }
     }
     #save
     if (!$result['message']) {
         $data = array('varName' => $_POST['varName'], 'varLastName' => $_POST['varLastName'], 'varBusiness' => $_POST['varBusiness'], 'varEmail' => $_POST['varEmail'], 'varPhone' => $_POST['varPhone'], 'idItem' => $_POST['idItem'], 'varContent' => $_POST['varContent'], 'dateUpdate' => date('Y-m-d H:i:s'), 'dateCreate' => date('Y-m-d H:i:s'));
         $data['dateCreate'] = date('Y-m-d H:i:s');
         $idReg = $this->DB->insert($this->table_name, $data);
         #mailing
         $this->DB->select(WP_PREFIX . 'maletek_pintalocker_config');
         $regs = $this->DB->get('array');
         $config = array();
         if ($regs) {
             foreach ($regs as $key => $r) {
                 $config[$r['varName']] = $r['varValue'];
             }
         }
         include_once MALETEKPL__PLUGIN_DIR . 'libs/phpmailer.v5/class.phpmailer.php';
         $mail = new PHPMailer();
         $mail->IsHTML();
         $mail->isMail();
         $mail->setLanguage('es');
         $mail->setFrom($config['varEmisorEmail'], $config['varEmisorName']);
         $mail->Subject = $config['textSubject'];
         $mail->Body = '<div style="background:#820a11;padding:10px 20px;margin:15px auto 0;"><img src="' . MALETEKPL__PLUGIN_URL . 'frontend' . DS . 'imgs' . DS . 'f_maletek.png" /></div><br/><br/>';
         $mail->Body .= str_replace('{link}', MALETEKPL__PLUGIN_URL . 'frontend/views/pdf.php?request=' . md5($idReg), nl2br($config['textBody']));
         $mail->addAddress($data['varEmail'], $data['varLastName'] . ', ' . $data['varName']);
         $varReceptor = explode(',', $config['varReceptor']);
         if ($varReceptor) {
             foreach ($varReceptor as $v) {
                 $mail->AddBCC($v);
             }
         }
         $mail->send();
         $result['status'] = 'info';
         $result['message'][] = 'Solicitud fue enviada correctamente, se le ha enviado una copia a su Email. Nos contactaremos a la brevedad. Para culminar el proceso de compra.';
     }
     $result['message'] = implode('<br/>', $result['message']);
     exit(json_encode($result));
 }
 /**
  * Miscellaneous calls to improve test coverage and some small tests.
  */
 public function testMiscellaneous()
 {
     $this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
     $this->Mail->addCustomHeader('SomeHeader: Some Value');
     $this->Mail->clearCustomHeaders();
     $this->Mail->clearAttachments();
     $this->Mail->isHTML(false);
     $this->Mail->isSMTP();
     $this->Mail->isMail();
     $this->Mail->isSendmail();
     $this->Mail->isQmail();
     $this->Mail->setLanguage('fr');
     $this->Mail->Sender = '';
     $this->Mail->createHeader();
     $this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
     $this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
     $this->assertTrue($this->Mail->set('AllowEmpty', null), 'Null property set failed');
     $this->assertTrue($this->Mail->set('AllowEmpty', false), 'Valid property set of null property failed');
     //Test pathinfo
     $a = '/mnt/files/飛兒樂 團光茫.mp3';
     $q = PHPMailer::mb_pathinfo($a);
     $this->assertEquals($q['dirname'], '/mnt/files', 'UNIX dirname not matched');
     $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'UNIX basename not matched');
     $this->assertEquals($q['extension'], 'mp3', 'UNIX extension not matched');
     $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'UNIX filename not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, PATHINFO_DIRNAME), '/mnt/files', 'Dirname path element not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, 'filename'), '飛兒樂 團光茫', 'Filename path element not matched');
     $a = 'c:\\mnt\\files\\飛兒樂 團光茫.mp3';
     $q = PHPMailer::mb_pathinfo($a);
     $this->assertEquals($q['dirname'], 'c:\\mnt\\files', 'Windows dirname not matched');
     $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'Windows basename not matched');
     $this->assertEquals($q['extension'], 'mp3', 'Windows extension not matched');
     $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'Windows filename not matched');
 }
Пример #30
-4
 /**
  * Send a prepared and rendered email locally.
  *
  * @param array $email
  * @return bool
  */
 protected function send_prepared(array $email)
 {
     if (!is_email($email['to_address'])) {
         Prompt_Logging::add_error(Prompt_Enum_Error_Codes::OUTBOUND, __('Attempted to send to an invalid email address.', 'Postmatic'), compact('email'));
         return false;
     }
     $this->local_mailer->clearAllRecipients();
     $this->local_mailer->clearCustomHeaders();
     $this->local_mailer->clearReplyTos();
     $this->local_mailer->From = $email['from_address'];
     $this->local_mailer->FromName = $email['from_name'];
     $this->local_mailer->addAddress($email['to_address'], $email['to_name']);
     if (!empty($email['reply_address'])) {
         $this->local_mailer->addReplyTo($email['reply_address'], $email['reply_name']);
     }
     $unsubscribe_types = array(Prompt_Enum_Message_Types::COMMENT, Prompt_Enum_Message_Types::POST);
     if (!empty($email['reply_address']) and in_array($email['message_type'], $unsubscribe_types)) {
         $this->local_mailer->addCustomHeader('List-Unsubscribe', '<mailto:' . $email['reply_address'] . '?body=unsubscribe>');
     }
     $this->local_mailer->Subject = $email['subject'];
     $this->local_mailer->Body = $email['html_content'];
     $this->local_mailer->AltBody = $email['text_content'];
     $this->local_mailer->ContentType = Prompt_Enum_Content_Types::HTML;
     $this->local_mailer->isMail();
     $this->local_mailer->CharSet = 'UTF-8';
     try {
         $this->local_mailer->send();
     } catch (phpmailerException $e) {
         Prompt_Logging::add_error('prompt_wp_mail', __('Failed sending an email locally. Did you know Postmatic can deliver email for you?', 'Prompt_Core'), array('email' => $email, 'error_info' => $this->local_mailer->ErrorInfo));
         return false;
     }
     return true;
 }