public function returnOneValidateCampaignUrls(\Swift_Mime_Message $message, &$failedRecipients = null)
 {
     $body = $message->getBody();
     // has a email-tracking-image at the end
     $this->assertContains("<img src='https://www.google-analytics.com/?tid=blabla", $body, "Email open tracking image not found.");
     // links have tracking-parameters
     $this->assertContains("&utm_medium=email", $body, "Email links are expected to have tracking parameters attached.");
     return 1;
 }
 /**
  * {@inheritdoc)
  */
 public function transform(\Swift_Mime_Message $message)
 {
     $processor = new Process($this->getCommand());
     $processor->setStdin($message->getBody());
     $processor->run();
     if ($processor->isSuccessful()) {
         $message->addPart($processor->getOutput(), 'text/plain');
     }
 }
Exemplo n.º 3
0
 public function send(Swift_Mime_Message $message, &$failedRecipients = null)
 {
     $failedRecipients = (array) $failedRecipients;
     $msg = '* ' . $message->getSubject() . ' *' . PHP_EOL . PHP_EOL;
     if ($message instanceof CM_Mail_Message) {
         $msg .= $message->getText() . PHP_EOL;
     } else {
         $msg .= $message->getBody() . PHP_EOL;
     }
     $logger = $this->getLogger();
     $context = new CM_Log_Context();
     $context->setExtra(['type' => CM_Paging_Log_Mail::getTypeStatic(), 'sender' => $message->getSender(), 'replyTo' => $message->getReplyTo(), 'to' => $message->getTo(), 'cc' => $message->getCc(), 'bcc' => $message->getBcc()]);
     $logger->addMessage($msg, $this->_logLevel, $context);
     return count($message->getTo()) + count($message->getCc()) + count($message->getBcc());
 }
 /**
  * {@inheritdoc)
  */
 public function transform(\Swift_Mime_Message $message)
 {
     $body = $message->getBody();
     $body = preg_replace_callback('/(src|background)="(http[^"]*)"/', function ($matches) use($message) {
         $attribute = $matches[1];
         $imagePath = $matches[2];
         if ($fp = fopen($imagePath, "r")) {
             $imagePath = $message->embed(\Swift_Image::fromPath($imagePath));
             fclose($fp);
         }
         return sprintf('%s="%s"', $attribute, $imagePath);
     }, $body);
     $body = preg_replace_callback('/url\\((http[^"]*)\\)/', function ($matches) use($message) {
         $imagePath = $matches[1];
         if ($fp = fopen($imagePath, "r")) {
             $imagePath = $message->embed(\Swift_Image::fromPath($imagePath));
             fclose($fp);
         }
         return sprintf('url(%s)', $imagePath);
     }, $body);
     $message->setBody($body, 'text/html');
 }
Exemplo n.º 5
0
 /**
  * Get the HTML content for the preview file.
  *
  * @return string
  */
 private function content()
 {
     return $this->info() . $this->message->getBody();
 }
Exemplo n.º 6
0
 /**
  * Define email to text/plain
  *
  * @param \Swift_Mime_Message $message E-mail message
  *
  * @access public
  * @return void
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function Html2Text(\Swift_Mime_Message &$message)
 {
     $text = strip_tags($message->getBody());
     $message->addPart($text, 'text/plain');
 }