コード例 #1
0
 /**
  * E-mails the formatted text as attachment.
  *
  * @param string $formatedText
  */
 public function write($formatedText)
 {
     $mail = new Mail();
     $mail->addTo($this->to);
     $mail->setFrom($this->from);
     $mail->setSubject($this->subject);
     $mail->setBodyHtml(file_get_contents($this->emailTemplate));
     $at = new Part($formatedText);
     $at->type = 'text/html';
     $at->disposition = Mime::DISPOSITION_INLINE;
     $at->encoding = Mime::ENCODING_BASE64;
     $at->filename = $this->attachmentName;
     $at->description = 'LiveTest Attachment';
     $mail->addAttachment($at);
     $mail->send();
 }
コード例 #2
0
 private function writeMail($bodyText, $atText = null)
 {
     $mail = new Mail();
     $mail->addTo($this->to);
     $mail->setFrom($this->from);
     $mail->setSubject($this->subject);
     $mail->setBodyHtml(file_get_contents($this->template) . $bodyText);
     if ($at !== null) {
         $at = new Part($atText);
         $at->type = 'text/html';
         $at->disposition = Mime::DISPOSITION_INLINE;
         $at->encoding = Mime::ENCODING_BASE64;
         $at->filename = $this->attachmentName;
         $at->description = 'LiveTest Attachment';
         $mail->addAttachment($at);
     }
     $mail->send();
 }
コード例 #3
0
ファイル: MailTest.php プロジェクト: niallmccrudden/zf2
    public function testAutoMessageId()
    {
        $mail = new Mail\Mail();
        $res = $mail->setBodyText('Message ID Test');
        $mail->setFrom('*****@*****.**', 'test Mail User');
        $mail->setSubject('Message ID Test');
        $mail->setMessageId();
        $mail->addTo('*****@*****.**');

        $mock = new TransportMock();
        $mail->send($mock);

        $this->assertTrue($mock->called);
        $this->assertTrue(isset($mock->headers['Message-Id']));
        $this->assertTrue(isset($mock->headers['Message-Id'][0]));
        $this->assertTrue(strlen($mock->headers['Message-Id'][0]) > 0);
    }
コード例 #4
0
ファイル: FileTest.php プロジェクト: hjr3/zf2
 protected function _prepareMail()
 {
     $mail = new Mail\Mail();
     $mail->setBodyText('This is the text of the mail.');
     $mail->setFrom('*****@*****.**', 'Alexander Steshenko');
     $mail->addTo('*****@*****.**', 'Oleg Lobach');
     $mail->setSubject('TestSubject');
     return $mail;
 }