Esempio n. 1
0
 /**
  * Raw send method. This does not replace markers, or reset the mail afterwards.
  *
  * @interal
  * @param   array      Record with receivers information as name => value pairs.
  * @param   array      Array with extra headers to apply to mails as name => value pairs.
  * @return   void
  */
 private function raw_send(Tx_Newsletter_Domain_Model_Email $email)
 {
     $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
     $message->setTo($email->getRecipientAddress())->setFrom(array($this->senderEmail => $this->senderName))->setSubject($this->title);
     if ($this->bounceAddress) {
         $message->setReturnPath($this->bounceAddress);
     }
     foreach ($this->attachments as $attachment) {
         $message->attach($attachment);
     }
     // Specify message-id for bounce identification
     $msgId = $message->getHeaders()->get('Message-ID');
     $msgId->setId($email->getAuthCode() . '@' . $this->newsletter->getDomain());
     // Build plaintext
     $plain = $this->getPlain();
     $recipientData = $email->getRecipientData();
     if ($recipientData['plain_only']) {
         $message->setBody($plain, 'text/plain');
     } else {
         // Attach inline files and replace markers used for URL
         foreach ($this->attachmentsEmbedded as $marker => $attachment) {
             $embeddedSrc = $message->embed($attachment);
             $plain = str_replace($marker, $embeddedSrc, $plain);
             $this->html = str_replace($marker, $embeddedSrc, $this->html);
         }
         $message->setBody($this->html, 'text/html');
         $message->addPart($plain, 'text/plain');
     }
     $message->send();
 }