當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Headers::addHeaderLine方法代碼示例

本文整理匯總了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;
 }
開發者ID:bradley-holt,項目名稱:zf2,代碼行數:15,代碼來源:Message.php

示例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());
 }
開發者ID:haoyanfei,項目名稱:zf2,代碼行數:10,代碼來源:SmtpTest.php

示例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());
 }
開發者ID:pnaq57,項目名稱:zf2demo,代碼行數:10,代碼來源:SmtpTest.php

示例4: testHeadersAddHeaderLineThrowsExceptionOnMissingFieldValue

 public function testHeadersAddHeaderLineThrowsExceptionOnMissingFieldValue()
 {
     $this->setExpectedException('Zend\\Mail\\Exception\\InvalidArgumentException', 'without a field');
     $headers = new Headers();
     $headers->addHeaderLine('Foo');
 }
開發者ID:bradley-holt,項目名稱:zf2,代碼行數:6,代碼來源:HeadersTest.php

示例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);
 }
開發者ID:thefox,項目名稱:phpchat,代碼行數:24,代碼來源:ImapCommand.php

示例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');
 }
開發者ID:razvansividra,項目名稱:pnlzf2-1,代碼行數:6,代碼來源:HeadersTest.php

示例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]);
 }
開發者ID:xamin123,項目名稱:platform,代碼行數:11,代碼來源:Imap.php

示例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);
 }
開發者ID:gridguyz,項目名稱:zork,代碼行數:11,代碼來源:Message.php


注:本文中的Zend\Mail\Headers::addHeaderLine方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。