Beispiel #1
0
 public function testImage()
 {
     $mail = $this->_root;
     $c = $mail->getComponent();
     $html = $c->getHtml();
     $mail = new Kwf_Mail();
     $mail->setBodyHtml($html, null, Zend_Mime::ENCODING_8BIT);
     $url = 'http://' . Kwf_Config::getValue('server.domain') . '/assets/kwf/images/rating/ratingStarFull.jpg';
     $this->assertEquals('<img src="' . $url . '" width="13" height="12" alt="" />', $mail->getBodyHtml(true));
     $mail = new Kwf_Mail();
     $mail->setAttachImages(true);
     $mail->setBodyHtml($html, null, Zend_Mime::ENCODING_8BIT);
     $this->assertEquals('<img src="cid:d8c33cb4a497ce1919c3662b7c5df05f" width="13" height="12" alt="" />', $mail->getBodyHtml(true));
 }
 public function createMail(Kwc_Mail_Recipient_Interface $recipient, $data = null, $toAddress = null, $format = null, $addViewTracker = true)
 {
     $this->_mailData = $data;
     $mail = new Kwf_Mail();
     $name = $recipient->getMailFirstname() . ' ' . $recipient->getMailLastname();
     if (!$recipient->getMailFirstname() || !$recipient->getMailLastname()) {
         //no name at all if we don't have a complete name
         $name = null;
     }
     if ($toAddress) {
         $mail->addTo($toAddress, $name);
     } else {
         $mail->addTo($recipient->getMailEmail(), $name);
     }
     if (!$format && $recipient->getMailFormat() == Kwc_Mail_Recipient_Interface::MAIL_FORMAT_HTML || $format == Kwc_Mail_Recipient_Interface::MAIL_FORMAT_HTML) {
         $html = $this->getHtml($recipient, $addViewTracker);
         $mail->setDomain($this->getData()->getDomain());
         $mail->setAttachImages($this->_getSetting('attachImages'));
         $mail->setBodyHtml($html);
     }
     $mail->setBodyText($this->getText($recipient));
     $mail->setSubject($this->getSubject($recipient));
     if ($this->_getSetting('fromEmail')) {
         $mail->setFrom($this->_getSetting('fromEmail'), $this->_getSetting('fromName'));
     }
     if ($this->_getSetting('replyEmail')) {
         $mail->setReplyTo($this->_getSetting('replyEmail'));
     }
     if ($this->_getSetting('returnPath')) {
         $mail->setReturnPath($this->_getSetting('returnPath'));
     }
     $bccs = $this->_getSetting('bcc');
     if ($bccs) {
         if (!is_array($bccs)) {
             $bccs = array($bccs);
         }
         foreach ($bccs as $bcc) {
             $mail->addBcc($bcc);
         }
     }
     return $mail;
 }