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


PHP Message::getCc方法代码示例

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


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

示例1: testCanSetCcListFromAddressList

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

示例2: send

 /**
  * {@inheritDoc}
  * @link http://help.postageapp.com/kb/api/send_message
  * @return array The id and UID of the sent message (if sent correctly)
  */
 public function send(Message $message)
 {
     $from = $message->getFrom();
     if (count($from) !== 1) {
         throw new Exception\RuntimeException('Postage API requires exactly one from sender');
     }
     if (count($message->getCc())) {
         throw new Exception\RuntimeException('Postage does not support CC addresses');
     }
     if (count($message->getBcc())) {
         throw new Exception\RuntimeException('Postage does not support BCC addresses');
     }
     $parameters = array('uid' => sha1(json_encode(uniqid())), 'arguments' => array('headers' => array('subject' => $message->getSubject(), 'from' => $from->rewind()->toString()), 'content' => array('text/plain' => $this->extractText($message), 'text/html' => $this->extractHtml($message))));
     $to = array();
     foreach ($message->getTo() as $address) {
         $to[] = $address->toString();
     }
     $parameters['arguments']['recipients'] = implode(',', $to);
     $replyTo = $message->getReplyTo();
     if (count($replyTo) > 1) {
         throw new Exception\RuntimeException('Postage has only support for one Reply-To address');
     } elseif (count($replyTo)) {
         $parameters['headers']['reply-to'] = $replyTo->rewind()->toString();
     }
     if ($message instanceof PostageMessage) {
         if ($message->getTemplate() !== '') {
             $parameters['arguments']['template'] = $message->getTemplate();
             $parameters['arguments']['variables'] = $message->getVariables();
         }
     }
     $attachments = $this->extractAttachments($message);
     foreach ($attachments as $attachment) {
         $parameters['arguments']['attachments'][$attachment->filename] = array('content_type' => $attachment->type, 'content' => base64_encode($attachment->getRawContent()));
     }
     $response = $this->prepareHttpClient('/send_message.json', $parameters)->send();
     $data = $this->parseResponse($response);
     return array('uid' => $parameters['uid'], 'id' => $data['message']['id']);
 }
开发者ID:erik-maas,项目名称:SlmMail,代码行数:43,代码来源:PostageService.php

示例3: prepareRecipients

 /**
  * Prepare array of email address recipients
  *
  * @param  Message $message
  * @return array
  */
 protected function prepareRecipients(Message $message)
 {
     $recipients = array();
     foreach ($message->getTo() as $address) {
         $recipients[] = $address->getEmail();
     }
     foreach ($message->getCc() as $address) {
         $recipients[] = $address->getEmail();
     }
     foreach ($message->getBcc() as $address) {
         $recipients[] = $address->getEmail();
     }
     $recipients = array_unique($recipients);
     return $recipients;
 }
开发者ID:Baft,项目名称:Zend-Form,代码行数:21,代码来源:Smtp.php

示例4: prepareRecipients

 /**
  * Prepare array of email address recipients
  *
  * @param  Message $message
  * @return array
  */
 protected function prepareRecipients(Message $message)
 {
     if ($this->getEnvelope() && $this->getEnvelope()->getTo()) {
         return (array) $this->getEnvelope()->getTo();
     }
     $recipients = [];
     foreach ($message->getTo() as $address) {
         $recipients[] = $address->getEmail();
     }
     foreach ($message->getCc() as $address) {
         $recipients[] = $address->getEmail();
     }
     foreach ($message->getBcc() as $address) {
         $recipients[] = $address->getEmail();
     }
     $recipients = array_unique($recipients);
     return $recipients;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:24,代码来源:Smtp.php

示例5: send

 /**
  * {@inheritDoc}
  * @link http://sendgrid.com/docs/API_Reference/Web_API/mail.html
  * @return mixed
  */
 public function send(Message $message)
 {
     $from = $message->getFrom();
     if (count($from) !== 1) {
         throw new Exception\RuntimeException('SendGrid API requires exactly one from sender');
     }
     if (count($message->getCc())) {
         throw new Exception\RuntimeException('SendGrid does not support CC addresses');
     }
     $parameters = array('from' => $from->rewind()->getEmail(), 'fromname' => $from->rewind()->getName(), 'subject' => $message->getSubject(), 'text' => $this->extractText($message), 'html' => $this->extractHtml($message));
     foreach ($message->getTo() as $address) {
         $parameters['to'][] = $address->getEmail();
     }
     foreach ($message->getBcc() as $address) {
         $parameters['bcc'][] = $address->getEmail();
     }
     $replyTo = $message->getReplyTo();
     if (count($replyTo) > 1) {
         throw new Exception\RuntimeException('SendGrid has only support for one Reply-To address');
     } elseif (count($replyTo)) {
         $parameters['replyto'] = $replyTo->rewind()->getEmail();
     }
     $client = $this->prepareHttpClient('/mail.send.json');
     // Set Parameters as POST, since prepareHttpClient() put only GET parameters
     $client->setParameterPost($parameters);
     // Eventually add files. This cannot be done before prepareHttpClient call because prepareHttpClient
     // reset all parameters (response, request...), therefore we would loose the file upload
     $post = $client->getRequest()->getPost();
     $attachments = $this->extractAttachments($message);
     foreach ($attachments as $attachment) {
         $post->set('files[' . $attachment->filename . ']', $attachment->getRawContent());
     }
     $response = $client->setMethod(HttpRequest::METHOD_POST)->setEncType(HttpClient::ENC_FORMDATA)->send();
     return $this->parseResponse($response);
 }
开发者ID:erik-maas,项目名称:SlmMail,代码行数:40,代码来源:SendGridService.php

示例6: 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

示例7: prepareAddressList

 /**
  * Prepares list of all mail recipients
  *
  * @param Message $message
  * @return array
  */
 private function prepareAddressList(Message $message)
 {
     $addressList = array();
     foreach ($message->getTo() as $address) {
         $addressList[] = $address->getEmail();
     }
     foreach ($message->getCc() as $address) {
         $addressList[] = $address->getEmail();
     }
     foreach ($message->getBcc() as $address) {
         $addressList[] = $address->getEmail();
     }
     return $addressList;
 }
开发者ID:guliano,项目名称:esco-mail,代码行数:20,代码来源:MailLogger.php


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