当前位置: 首页>>代码示例>>PHP>>正文


PHP Message::getReplyTo方法代码示例

本文整理汇总了PHP中Zend\Mail\Message::getReplyTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::getReplyTo方法的具体用法?PHP Message::getReplyTo怎么用?PHP Message::getReplyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Mail\Message的用法示例。


在下文中一共展示了Message::getReplyTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCanSetReplyToListFromAddressList

 public function testCanSetReplyToListFromAddressList()
 {
     $list = new AddressList();
     $list->add('zf-devteam@zend.com');
     $this->message->addReplyTo('fw-announce@lists.zend.com');
     $this->message->setReplyTo($list);
     $replyTo = $this->message->getReplyTo();
     $this->assertEquals(1, count($replyTo));
     $this->assertFalse($replyTo->has('fw-announce@lists.zend.com'));
     $this->assertTrue($replyTo->has('zf-devteam@zend.com'));
 }
开发者ID:nuklehed,项目名称:zf2,代码行数:11,代码来源:MessageTest.php

示例2: convertZFMail

 /**
  * Create `Mandrill message` from `ZF message`.
  *
  * @param ZendMessage $zfMessage
  *
  * @return Message
  */
 public static function convertZFMail(ZendMessage $zfMessage)
 {
     $mandrillMessage = new self();
     // GET HTML MIME PART
     $messageHtmlPart = $messageTextPart = null;
     $mimeParts = $zfMessage->getBody()->getParts();
     foreach ($mimeParts as $mimePart) {
         switch ($mimePart->getType()) {
             case ZendMime::TYPE_HTML:
                 $messageHtmlPart = $mimePart->getContent();
                 break;
             case ZendMime::TYPE_TEXT:
                 $messageTextPart = $mimePart->getContent();
                 break;
         }
     }
     // text part
     if ($messageTextPart !== null) {
         $mandrillMessage->text = $messageTextPart;
     }
     // html part
     if ($messageHtmlPart !== null) {
         $mandrillMessage->html = $messageHtmlPart;
     }
     // subject
     if ($zfMessage->getSubject() !== null) {
         $mandrillMessage->subject = $zfMessage->getSubject();
     }
     // from
     if ($zfMessage->getFrom()->count()) {
         $mandrillMessage->from_email = $zfMessage->getFrom()->current()->getEmail();
         $mandrillMessage->from_name = $zfMessage->getFrom()->current()->getName();
     }
     // reply-to
     if ($zfMessage->getReplyTo()->count()) {
         $mandrillMessage->headers = ['Reply-To' => $zfMessage->getReplyTo()->current()->getEmail()];
     }
     // to
     if ($zfMessage->getTo()->count()) {
         foreach ($zfMessage->getTo() as $to) {
             $mandrillMessage->addRecipient(new Recipient($to->getEmail(), null, Recipient::RECIPIENT_TYPE_TO));
         }
     }
     // cc
     if ($zfMessage->getCc()->count()) {
         foreach ($zfMessage->getCc() as $cc) {
             $mandrillMessage->addRecipient(new Recipient($cc->getEmail(), null, Recipient::RECIPIENT_TYPE_CC));
         }
     }
     // bcc
     if ($zfMessage->getBcc()->count()) {
         foreach ($zfMessage->getBcc() as $bcc) {
             $mandrillMessage->addRecipient(new Recipient($bcc->getEmail(), null, Recipient::RECIPIENT_TYPE_BCC));
         }
     }
     return $mandrillMessage;
 }
开发者ID:freax,项目名称:mandrill-zend2,代码行数:64,代码来源:Message.php


注:本文中的Zend\Mail\Message::getReplyTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。