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


PHP Message::getSender方法代码示例

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


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

示例1: testCanProvideAddressObjectWhenSettingSender

 public function testCanProvideAddressObjectWhenSettingSender()
 {
     $sender = new Address('zf-devteam@zend.com');
     $this->message->setSender($sender);
     $test = $this->message->getSender();
     $this->assertSame($sender, $test);
 }
开发者ID:nuklehed,项目名称:zf2,代码行数:7,代码来源:MessageTest.php

示例2: convert

 /**
  * 
  * @param Message $message
  * @return ZendMessage
  */
 public static function convert(Message $message)
 {
     $mailMessage = new ZendMessage();
     $mailMessage->setSubject($message->getSubject());
     $mailMessage->setFrom($message->getFrom());
     $mailMessage->setTo($message->getTo());
     $mailMessage->setCc($message->getCc());
     $mailMessage->setBcc($message->getBcc());
     $mailMessage->setReplyTo($message->getReplyTo());
     $mailMessage->getHeaders()->addHeaders($message->getHeaders());
     if ($mailMessage->getSender()) {
         $mailMessage->setSender($message->getSender());
     }
     if ($message->isMultipart()) {
         $mimePart = new MimeMessage();
         if ($message->getBodyHtml()) {
             $part = new Part($message->getBodyHtml());
             $part->charset = $message->getCharset();
             $part->encoding = $message->getEncoding();
             $part->type = Mime::TYPE_HTML;
             $mimePart->addPart($part);
         }
         if ($message->getBodyText()) {
             $part = new Part($message->getBodyText());
             $part->charset = $message->getCharset();
             $part->encoding = $message->getEncoding();
             $part->type = Mime::TYPE_TEXT;
             $mimePart->addPart($part);
         }
         foreach ($message->getAttachments() as $attachment) {
             $mimePart->addPart($attachment->asMimePart());
         }
         foreach ($message->getParts() as $part) {
             $mimePart->addPart($part);
         }
         $mailMessage->setBody($mimePart);
     } else {
         $mailMessage->getHeaders()->addHeaderLine('Content-Type', $message->getContentType());
         $mailMessage->setEncoding($message->getEncoding());
         $mailMessage->setBody($message->getFilledBody());
     }
     return $mailMessage;
 }
开发者ID:alex-oleshkevich,项目名称:zf-extras,代码行数:48,代码来源:MessageConverter.php

示例3: send

 /**
  * @param Message $message
  * @param null $transport
  * @return mixed
  */
 public function send(Message $message, $transport = null)
 {
     if (!$message->getSender()) {
         $sender = $transport ? $transport : 'default';
         $emailAddress = $this->getOption('addressList')[$sender];
         $message->setSender($emailAddress['address'], $emailAddress['name']);
     }
     return $this->getMailTransport($transport)->send($message);
 }
开发者ID:uthando-cms,项目名称:uthando-mail,代码行数:14,代码来源:Mail.php

示例4: prepareFromAddress

 /**
  * Retrieve email address for envelope FROM 
  * 
  * @param  Message $message 
  * @return string
  */
 protected function prepareFromAddress(Message $message)
 {
     $sender = $message->getSender();
     if ($sender instanceof AddressDescription) {
         return $sender->getEmail();
     }
     $from = $message->from();
     if (!count($from)) {
         throw new Exception\RuntimeException(sprintf('%s transport expects either a Sender or at least one From address in the Message; none provided', __CLASS__));
     }
     $from->rewind();
     $sender = $from->current();
     return $sender->getEmail();
 }
开发者ID:nevvermind,项目名称:zf2,代码行数:20,代码来源:Smtp.php

示例5: prepareParameters

 /**
  * Prepare additional_parameters argument
  *
  * Basically, overrides the MAIL FROM envelope with either the Sender or
  * From address.
  *
  * @param  \Zend\Mail\Message $message
  * @return string
  */
 protected function prepareParameters(Mail\Message $message)
 {
     if ($this->isWindowsOs()) {
         return null;
     }
     $parameters = (string) $this->parameters;
     $sender = $message->getSender();
     if ($sender instanceof AddressInterface) {
         $parameters .= ' -f ' . $sender->getEmail();
         return $parameters;
     }
     $from = $message->getFrom();
     if (count($from)) {
         $from->rewind();
         $sender = $from->current();
         $parameters .= ' -f ' . $sender->getEmail();
         return $parameters;
     }
     return $parameters;
 }
开发者ID:eltondias,项目名称:Relogio,代码行数:29,代码来源:Sendmail.php

示例6: prepareFromAddress

 /**
  * Retrieve email address for envelope FROM
  *
  * @param  Message $message
  * @throws Exception\RuntimeException
  * @return string
  */
 protected function prepareFromAddress(Message $message)
 {
     if ($this->getEnvelope() && $this->getEnvelope()->getFrom()) {
         return $this->getEnvelope()->getFrom();
     }
     $sender = $message->getSender();
     if ($sender instanceof Address\AddressInterface) {
         return $sender->getEmail();
     }
     $from = $message->getFrom();
     if (!count($from)) {
         // Per RFC 2822 3.6
         throw new Exception\RuntimeException(sprintf('%s transport expects either a Sender or at least one From address in the Message; none provided', __CLASS__));
     }
     $from->rewind();
     $sender = $from->current();
     return $sender->getEmail();
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:25,代码来源:Smtp.php


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