private function maybeAttachAddress(&$email)
 {
     $htmlAddress = $this->getHtmlAddress();
     if (strstr($email['htmlbody'], $this->canSpamShortCode)) {
         $email['htmlbody'] = str_replace($this->canSpamShortCode, $htmlAddress, $email['htmlbody']);
     } else {
         $email['htmlbody'] .= $htmlAddress;
     }
     $textAddress = JavelinConfig::senderAddress();
     if (strstr($email['textbody'], $this->canSpamShortCode)) {
         $email['textbody'] = str_replace($this->canSpamShortCode, $textAddress, $email['textbody']);
     } else {
         $email['textbody'] .= "\r\n" . $textAddress;
     }
 }
function dispatchEmail($mail)
{
    try {
        $transport = getMailTransport();
        $mailer = Swift_Mailer::newInstance($transport);
        $message = Swift_Message::newInstance($mail['subject']);
        $message->setFrom(array($mail['from'] => $mail['fromname']));
        $message->setTo(array($mail['to']));
        if (!empty($mail['reply_to']) && validateEmail($mail['reply_to'])) {
            $message->setReplyTo($mail['reply_to']);
        }
        $mail['textbody'] = stripslashes($mail['textbody']);
        if ($mail['htmlenabled'] == 1 && !empty($mail['htmlbody'])) {
            $mail['htmlbody'] = stripslashes($mail['htmlbody']);
            if (JavelinConfig::attach_images_with_emails()) {
                attachImagesToMessageAndSetBody($message, $mail['htmlbody']);
            } else {
                $message->setBody($mail['htmlbody'], 'text/html');
            }
            $message->addPart($mail['textbody'], 'text/plain');
        } else {
            $message->setBody($mail['textbody'], 'text/plain');
        }
        $mailer->send($message);
        _wpr_increment_hourly_email_sent_count();
    } catch (Exception $exp) {
        //do something here..
    }
}
 /**
  * @param $email
  * @return string
  */
 private function getExpectedTextBody($email)
 {
     return sprintf("%s\r\n%s\r\nClick here to unsubscribe:\r\n%s", $email['textbody'], JavelinConfig::senderAddress(), $this->subscriber->getUnsubscriptionUrl());
 }