本文整理汇总了PHP中Swift_Message::getDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_Message::getDate方法的具体用法?PHP Swift_Message::getDate怎么用?PHP Swift_Message::getDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift_Message
的用法示例。
在下文中一共展示了Swift_Message::getDate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWritingMessageToByteStreamTwiceUsingAFileAttachment
public function testWritingMessageToByteStreamTwiceUsingAFileAttachment()
{
$message = new Swift_Message();
$message->setSubject('test subject');
$message->setTo('user@domain.tld');
$message->setCc('other@domain.tld');
$message->setFrom('user@domain.tld');
$attachment = Swift_Attachment::fromPath($this->_attFile);
$message->attach($attachment);
$message->setBody('HTML part', 'text/html');
$id = $message->getId();
$date = preg_quote(date('r', $message->getDate()), '~');
$boundary = $message->getBoundary();
$streamA = new Swift_ByteStream_ArrayByteStream();
$streamB = new Swift_ByteStream_ArrayByteStream();
$pattern = '~^' . 'Message-ID: <' . $id . '>' . "\r\n" . 'Date: ' . $date . "\r\n" . 'Subject: test subject' . "\r\n" . 'From: user@domain.tld' . "\r\n" . 'To: user@domain.tld' . "\r\n" . 'Cc: other@domain.tld' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: multipart/mixed;' . "\r\n" . ' boundary="' . $boundary . '"' . "\r\n" . "\r\n\r\n" . '--' . $boundary . "\r\n" . 'Content-Type: text/html; charset=utf-8' . "\r\n" . 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . "\r\n" . 'HTML part' . "\r\n\r\n" . '--' . $boundary . "\r\n" . 'Content-Type: ' . $this->_attFileType . '; name=' . $this->_attFileName . "\r\n" . 'Content-Transfer-Encoding: base64' . "\r\n" . 'Content-Disposition: attachment; filename=' . $this->_attFileName . "\r\n" . "\r\n" . preg_quote(base64_encode(file_get_contents($this->_attFile)), '~') . "\r\n\r\n" . '--' . $boundary . '--' . "\r\n" . '$~D';
$message->toByteStream($streamA);
$message->toByteStream($streamB);
$this->assertPatternInStream($pattern, $streamA);
$this->assertPatternInStream($pattern, $streamB);
}
示例2: getDate
/**
* {@inheritdoc}
*/
public function getDate()
{
return $this->message->getDate();
}
示例3: testCreatesPreviewFiles
public function testCreatesPreviewFiles()
{
$message = new Swift_Message('Foo subject', '<html>Body</html>', 'text/html');
$message->setFrom('myself@example.com', 'Jack Black');
$message->setTo('me@example.com');
$files = m::mock('Illuminate\\Filesystem\\Filesystem');
$transport = new PreviewTransport($files, 'framework/emails');
$files->shouldReceive('exists')->once()->with('framework/emails')->andReturn(true);
$files->shouldReceive('files')->once()->with('framework/emails')->andReturn([]);
$files->shouldReceive('put')->with('framework/emails/' . $message->getDate() . '_me_at_example_com_foo_subject.html', m::any());
$files->shouldReceive('put')->with('framework/emails/' . $message->getDate() . '_me_at_example_com_foo_subject.eml', $message->toString());
$transport->send($message);
}
示例4: testEmbeddedFilesWithMultipartDataCreateMultipartRelatedContentAsAnAlternative
public function testEmbeddedFilesWithMultipartDataCreateMultipartRelatedContentAsAnAlternative()
{
$message = new Swift_Message();
$message->setCharset('utf-8');
$message->setSubject('test subject');
$message->addPart('plain part', 'text/plain');
$image = new Swift_Image('<image data>', 'image.gif', 'image/gif');
$cid = $message->embed($image);
$message->setBody('<img src="' . $cid . '" />', 'text/html');
$message->setTo(array('user@domain.tld' => 'User'));
$message->setFrom(array('other@domain.tld' => 'Other'));
$message->setSender(array('other@domain.tld' => 'Other'));
$id = $message->getId();
$date = preg_quote(date('r', $message->getDate()), '~');
$boundary = $message->getBoundary();
$cidVal = $image->getId();
$this->assertRegExp('~^' . 'Sender: Other <other@domain.tld>' . "\r\n" . 'Message-ID: <' . $id . '>' . "\r\n" . 'Date: ' . $date . "\r\n" . 'Subject: test subject' . "\r\n" . 'From: Other <other@domain.tld>' . "\r\n" . 'To: User <user@domain.tld>' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: multipart/alternative;' . "\r\n" . ' boundary="' . $boundary . '"' . "\r\n" . "\r\n\r\n" . '--' . $boundary . "\r\n" . 'Content-Type: text/plain; charset=utf-8' . "\r\n" . 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . "\r\n" . 'plain part' . "\r\n\r\n" . '--' . $boundary . "\r\n" . 'Content-Type: multipart/related;' . "\r\n" . ' boundary="(.*?)"' . "\r\n" . "\r\n\r\n" . '--\\1' . "\r\n" . 'Content-Type: text/html; charset=utf-8' . "\r\n" . 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . "\r\n" . '<img.*?/>' . "\r\n\r\n" . '--\\1' . "\r\n" . 'Content-Type: image/gif; name=image.gif' . "\r\n" . 'Content-Transfer-Encoding: base64' . "\r\n" . 'Content-Disposition: inline; filename=image.gif' . "\r\n" . 'Content-ID: <' . $cidVal . '>' . "\r\n" . "\r\n" . preg_quote(base64_encode('<image data>'), '~') . "\r\n\r\n" . '--\\1--' . "\r\n" . "\r\n\r\n" . '--' . $boundary . '--' . "\r\n" . '$~D', $message->toString());
}
示例5: testHTMLPartAppearsLastEvenWhenAttachmentsAdded
public function testHTMLPartAppearsLastEvenWhenAttachmentsAdded()
{
$message = new Swift_Message();
$message->setCharset('utf-8');
$message->setSubject('test subject');
$message->addPart('plain part', 'text/plain');
$attachment = new Swift_Attachment('<data>', 'image.gif', 'image/gif');
$message->attach($attachment);
$message->setBody('HTML part', 'text/html');
$message->setTo(array('user@domain.tld' => 'User'));
$message->setFrom(array('other@domain.tld' => 'Other'));
$message->setSender(array('other@domain.tld' => 'Other'));
$id = $message->getId();
$date = preg_quote($message->getDate()->format('r'), '~');
$boundary = $message->getBoundary();
$this->assertRegExp('~^' . 'Sender: Other <other@domain.tld>' . "\r\n" . 'Message-ID: <' . $id . '>' . "\r\n" . 'Date: ' . $date . "\r\n" . 'Subject: test subject' . "\r\n" . 'From: Other <other@domain.tld>' . "\r\n" . 'To: User <user@domain.tld>' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: multipart/mixed;' . "\r\n" . ' boundary="' . $boundary . '"' . "\r\n" . "\r\n\r\n" . '--' . $boundary . "\r\n" . 'Content-Type: multipart/alternative;' . "\r\n" . ' boundary="(.*?)"' . "\r\n" . "\r\n\r\n" . '--\\1' . "\r\n" . 'Content-Type: text/plain; charset=utf-8' . "\r\n" . 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . "\r\n" . 'plain part' . "\r\n\r\n" . '--\\1' . "\r\n" . 'Content-Type: text/html; charset=utf-8' . "\r\n" . 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . "\r\n" . 'HTML part' . "\r\n\r\n" . '--\\1--' . "\r\n" . "\r\n\r\n" . '--' . $boundary . "\r\n" . 'Content-Type: image/gif; name=image.gif' . "\r\n" . 'Content-Transfer-Encoding: base64' . "\r\n" . 'Content-Disposition: attachment; filename=image.gif' . "\r\n" . "\r\n" . preg_quote(base64_encode('<data>'), '~') . "\r\n\r\n" . '--' . $boundary . '--' . "\r\n" . '$~D', $message->toString());
}