本文整理汇总了PHP中Zend\Mail\Headers::addHeaderLine方法的典型用法代码示例。如果您正苦于以下问题:PHP Headers::addHeaderLine方法的具体用法?PHP Headers::addHeaderLine怎么用?PHP Headers::addHeaderLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Mail\Headers
的用法示例。
在下文中一共展示了Headers::addHeaderLine方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: headers
/**
* Access headers collection
*
* Lazy-loads if not already attached.
*
* @return Headers
*/
public function headers()
{
if (null === $this->headers) {
$this->setHeaders(new Headers());
$this->headers->addHeaderLine('Date', date('r'));
}
return $this->headers;
}
示例2: testSendMinimalMail
public function testSendMinimalMail()
{
$headers = new Headers();
$headers->addHeaderLine('Date', 'Sun, 10 Jun 2012 20:07:24 +0200');
$message = new Message();
$message->setHeaders($headers)->setSender('ralph.schindler@zend.com', 'Ralph Schindler')->setBody('testSendMailWithoutMinimalHeaders')->addTo('zf-devteam@zend.com', 'ZF DevTeam');
$expectedMessage = "RSET\r\n" . "MAIL FROM:<ralph.schindler@zend.com>\r\n" . "DATA\r\n" . "Date: Sun, 10 Jun 2012 20:07:24 +0200\r\n" . "Sender: Ralph Schindler <ralph.schindler@zend.com>\r\n" . "To: ZF DevTeam <zf-devteam@zend.com>\r\n" . "\r\n" . "testSendMailWithoutMinimalHeaders\r\n" . ".\r\n";
$this->transport->send($message);
$this->assertEquals($expectedMessage, $this->connection->getLog());
}
示例3: testSendEscapedEmail
public function testSendEscapedEmail()
{
$headers = new Headers();
$headers->addHeaderLine('Date', 'Sun, 10 Jun 2012 20:07:24 +0200');
$message = new Message();
$message->setHeaders($headers)->setSender('ralph.schindler@zend.com', 'Ralph Schindler')->setBody("This is a test\n.")->addTo('zf-devteam@zend.com', 'ZF DevTeam');
$expectedMessage = "EHLO localhost\r\n" . "MAIL FROM:<ralph.schindler@zend.com>\r\n" . "DATA\r\n" . "Date: Sun, 10 Jun 2012 20:07:24 +0200\r\n" . "Sender: Ralph Schindler <ralph.schindler@zend.com>\r\n" . "To: ZF DevTeam <zf-devteam@zend.com>\r\n" . "\r\n" . "This is a test\r\n" . "..\r\n" . ".\r\n";
$this->transport->send($message);
$this->assertEquals($expectedMessage, $this->connection->getLog());
}
示例4: testHeadersAddHeaderLineThrowsExceptionOnMissingFieldValue
public function testHeadersAddHeaderLineThrowsExceptionOnMissingFieldValue()
{
$this->setExpectedException('Zend\\Mail\\Exception\\InvalidArgumentException', 'without a field');
$headers = new Headers();
$headers->addHeaderLine('Foo');
}
示例5: mailAdd
public function mailAdd($version, $id, $srcNodeId, $srcUserNickname, $dstNodeId, $subject, $text, $checksum, $relayCount, $encryptionMode, $status, $timeCreated, $timeReceived)
{
$this->log->info('mail add: ' . $id);
$this->log->info('subject: ' . $subject);
$this->log->info('from: ' . $srcNodeId);
$this->log->info('nick: ' . $srcUserNickname);
$headers = new ZendMailHeaders();
$headers->addHeaderLine('Date', date('r', $timeReceived));
$headers->addHeaderLine('X-Version', $version);
$headers->addHeaderLine('X-Id', $id);
$headers->addHeaderLine('X-Checksum', $checksum);
$headers->addHeaderLine('X-RelayCount', $relayCount);
$headers->addHeaderLine('X-EncrptionMode', $encryptionMode);
$headers->addHeaderLine('X-Status', $status);
$headers->addHeaderLine('X-TimeCreated', $timeCreated);
$headers->addHeaderLine('X-TimeReceived', $timeReceived);
$message = new ZendMailMessage();
$message->setHeaders($headers);
$message->addFrom($srcNodeId . '@phpchat.fox21.at', $srcUserNickname);
$message->addTo($dstNodeId . '@phpchat.fox21.at');
$message->setSubject($subject);
$message->setBody($text);
$this->server->addMail($message);
}
示例6: testHeadersAddHeaderLineThrowsExceptionOnMissingFieldValue
public function testHeadersAddHeaderLineThrowsExceptionOnMissingFieldValue()
{
$this->setExpectedException('Zend\\Mail\\Header\\Exception\\InvalidArgumentException', 'Header must match with the format "name: value"');
$headers = new Mail\Headers();
$headers->addHeaderLine('Foo');
}
示例7: setExtHeaders
/**
* Sets additional message headers
*
* @param \Zend\Mail\Headers $headers
* @param array $data
*/
protected function setExtHeaders(&$headers, array $data)
{
$headers->addHeaderLine(self::UID, $data[self::UID]);
$headers->addHeaderLine('InternalDate', $data[self::INTERNALDATE]);
}
示例8: setHeaders
/**
* Compose headers
*
* @param \Zend\Mail\Headers $headers
* @return \Zork\Mail\Message
*/
public function setHeaders(Headers $headers)
{
$headers->addHeaderLine('User-Agent', static::USER_AGENT)->addHeaderLine('X-Mailer', static::USER_AGENT);
return parent::setHeaders($headers);
}