コード例 #1
0
ファイル: MessageTest.php プロジェクト: mast3rpee/blw
 /**
  * @depends test_toString
  * @depends test_construct
  * @covers ::createFromString
  * @covers ::_createHeader
  */
 public function test_createFromString()
 {
     if (!is_callable('imap_rfc822_parse_headers')) {
         return;
     }
     $Container = new GenericContainer('object');
     $Container[] = new GenericEmailAddress('*****@*****.**');
     $this->MimeMessage->getHeader()->append(new Generic('Foo', 'bar1'));
     $this->MimeMessage->getHeader()->append(new Generic('Foo', 'bar2'));
     $this->MimeMessage->getHeader()->offsetSet('CC', new CC($Container));
     # Unimplemented
     try {
         $this->assertEquals($this->MimeMessage, $this->MimeMessage->createFromString(strval($this->MimeMessage)), 'MimeMessage::createFromString((string) MimeMessage should equal MimeMessage');
     } catch (\RuntimeException $e) {
     }
     # Invalid values
     try {
         $this->MimeMessage->createFromString(null);
         $this->fail('Failed to generate exception with invalid arguments');
     } catch (InvalidArgumentException $e) {
     }
 }
コード例 #2
0
ファイル: GenericMessage.php プロジェクト: mast3rpee/blw
 /**
  * Adds body without inline attatchments.
  *
  * @ignore
  * @param \BLW\Model\MIME\Message $MimeMessage
  */
 public function _addBodyWithoutInlineAttachments(MIMEMessage $MimeMessage)
 {
     // Add Body
     $MimeMessage->getBody()->addSection(new Section('multipart/alternative'));
     // 1. Text
     $MimeMessage->getBody()->addPart(new QuotedPrintable('text/html', $this->_Text, 'utf-8'));
     // 2. HTML
     if (($Document = $this->_HTML) instanceof \DOMDocument) {
         $MimeMessage->getBody()->addPart(new QuotedPrintable('text/html', $Document->saveHTML(), 'utf-8'));
     }
     // End multipart/alternative
     $MimeMessage->getBody()->endSection();
 }