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


PHP Message::addCC方法代码示例

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


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

示例1: send

 public function send(Email $email)
 {
     $message = new Message();
     $config = $this->config;
     if ($email->get('from')) {
         $fromName = null;
         if (!empty($this->params['fromName'])) {
             $fromName = $this->params['fromName'];
         } else {
             $fromName = $config->get('outboundEmailFromName');
         }
         $message->addFrom(trim($email->get('from')), $fromName);
     } else {
         if (!empty($this->params['fromAddress'])) {
             $fromAddress = $this->params['fromAddress'];
         } else {
             if (!$config->get('outboundEmailFromAddress')) {
                 throw new Error('outboundEmailFromAddress is not specified in config.');
             }
             $fromAddress = $config->get('outboundEmailFromAddress');
         }
         if (!empty($this->params['fromName'])) {
             $fromName = $this->params['fromName'];
         } else {
             $fromName = $config->get('outboundEmailFromName');
         }
         $message->addFrom($fromAddress, $fromName);
     }
     $value = $email->get('to');
     if ($value) {
         $arr = explode(';', $value);
         if (is_array($arr)) {
             foreach ($arr as $address) {
                 $message->addTo(trim($address));
             }
         }
     }
     $value = $email->get('cc');
     if ($value) {
         $arr = explode(';', $value);
         if (is_array($arr)) {
             foreach ($arr as $address) {
                 $message->addCC(trim($address));
             }
         }
     }
     $value = $email->get('bcc');
     if ($value) {
         $arr = explode(';', $value);
         if (is_array($arr)) {
             foreach ($arr as $address) {
                 $message->addBCC(trim($address));
             }
         }
     }
     $message->setSubject($email->get('name'));
     $body = new MimeMessage();
     $parts = array();
     if ($email->get('isHtml')) {
         $bodyPart = new MimePart($email->getBodyForSending());
         $bodyPart->type = 'text/html';
         $bodyPart->charset = 'utf-8';
     } else {
         if ($email->get('bodyPlain')) {
             $bodyPart = new MimePart($email->get('bodyPlain'));
         } else {
             $bodyPart = new MimePart($email->get('body'));
         }
         $bodyPart->type = 'text/plain';
         $bodyPart->charset = 'utf-8';
     }
     $parts[] = $bodyPart;
     $aCollection = $email->get('attachments');
     if (!empty($aCollection)) {
         foreach ($aCollection as $a) {
             $fileName = 'data/upload/' . $a->id;
             $attachment = new MimePart(file_get_contents($fileName));
             $attachment->disposition = Mime::DISPOSITION_ATTACHMENT;
             $attachment->encoding = Mime::ENCODING_BASE64;
             $attachment->filename = $a->get('name');
             if ($a->get('type')) {
                 $attachment->type = $a->get('type');
             }
             $parts[] = $attachment;
         }
     }
     $aCollection = $email->getInlineAttachments();
     if (!empty($aCollection)) {
         foreach ($aCollection as $a) {
             $fileName = 'data/upload/' . $a->id;
             $attachment = new MimePart(file_get_contents($fileName));
             $attachment->disposition = Mime::DISPOSITION_INLINE;
             $attachment->encoding = Mime::ENCODING_BASE64;
             $attachment->id = $a->id;
             if ($a->get('type')) {
                 $attachment->type = $a->get('type');
             }
             $parts[] = $attachment;
         }
     }
//.........这里部分代码省略.........
开发者ID:jdavis593,项目名称:appitechture,代码行数:101,代码来源:Sender.php

示例2: getValid

 /**
  * @return Message
  */
 public static function getValid()
 {
     $message = new Message();
     $message->setFrom(MailWrapperTestBootstrap::$from);
     $message->addTo(MailWrapperTestBootstrap::$toAddresses[0]);
     $message->addTo(MailWrapperTestBootstrap::$toAddresses[1]);
     $message->addCC(MailWrapperTestBootstrap::$ccAddresses[0]);
     $message->addCC(MailWrapperTestBootstrap::$ccAddresses[1]);
     $message->addBCC(MailWrapperTestBootstrap::$bccAddresses[0]);
     $message->addBCC(MailWrapperTestBootstrap::$bccAddresses[1]);
     $message->addReplyTo(MailWrapperTestBootstrap::$alternate);
     $message->setSubject(MailWrapperTestBootstrap::$subject);
     $message->setBody(MailWrapperTestBootstrap::$contentText);
     return $message;
 }
开发者ID:BespokeSupport,项目名称:MailWrapper,代码行数:18,代码来源:TesterMessageZend.php

示例3: date

 function send_note_to_essayTeam($uid, $row_id, $user_text1, $user_text2, $to)
 {
     $user_text1 = str_replace("\n", "<br/>", $user_text1);
     $user_text2 = str_replace("\n", "<br/>", $user_text2);
     $msg = "<html>\n\t\t<head>\n\t\t<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />\n\t\t<title>UCEazy - Essay Alert</title>\n\t\t<meta name='viewport' content='width=device-width, initial-scale=1.0'/>\n\t\t<style>\n\t\ttd{\n\t\t\twidth: 34%;\n\t\t}\n\t\t</style>\n\t\t</head>\n\t\t<body style='margin: 0; padding: 0; '>\n\t\t<table align='center' border='0' cellpadding='0' cellspacing='0' width='600' style='border-collapse: collapse; '>\n\t\t<tr>\n\t\t<td style='width: 34%;'>\n\t\tHi there,<br><br>\n\t\t The Candidate details as below, \n\t\t</td>\n\t\t\n\t\t</tr>\n\t\t\n\t\t<tr>\n\n\t\t\t<td style='width: 34%;'>\n\t\t\t<br><br>\n\t\t\t<b>user ID</b>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t<br><br>\n\t\t\t" . $uid . "\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t<td style='width: 34%;'>\n\t\t\t<br><br>\n\t\t\t<b>Essay ID</b>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t<br><br>\n\t\t\t" . $row_id . "\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t<td style='width: 34%;'>\n\t\t\t<br><br>\n\t\t\t<b>Submitted On</b>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t<br><br>\n\t\t\t" . date('d-m-Y') . "\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t<td style='width: 34%;'>\n\t\t\t<br><br>\n\t\t\t<b>Essay-1 </b>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t<br><br>\n\t\t\t" . $user_text1 . "\t\t\t\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t<td style='width: 34%;'>\n\t\t\t<br><br>\n\t\t\t<b>Essay-2</b>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t<br><br>\n\t\t\t" . $user_text2 . "\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t<tr>\n\t\t\t\t<td style='width: 34%;'><br>\n\t\t\t\tSincerely,\n\t\t\t\t\n\t\t\t\t</tr>\t\t\n\t\t\t\t\n\t\t<tr>\n\t\t\t\t<td>\t\t\n\t\t\t\tUCEazy\n\t\t\t\t</td>\n\t\t\t\t</tr>\t\t\t\n\t\t\t</table></body></html>\t\n\t\t\t\t";
     $smtpOptions = new Transport\SmtpOptions($this->options);
     $smtp = new Transport\Smtp($smtpOptions);
     $htmlPart = new MimePart($msg);
     $htmlPart->type = "text/html";
     $body = new MimeMessage();
     $body->setParts(array($htmlPart));
     $mail = new Mail\Message();
     $mail->setBody($body);
     $mail->setFrom('noreply@uceazy.com', 'noreply@uceazy.com');
     $mail->addTo($to, $to);
     $mail->addCC("jsyadav@gmail.com", "jsyadav@gmail.com");
     $mail->setSubject($row_id);
     $smtp->send($mail);
 }
开发者ID:shivap87,项目名称:cost,代码行数:19,代码来源:EmailManager.php

示例4: send

 public function send(Email $email, $params = array(), &$message = null, $attachmetList = [])
 {
     if (!$message) {
         $message = new Message();
     }
     $config = $this->config;
     $params = $this->params + $params;
     if ($email->get('from')) {
         $fromName = null;
         if (!empty($params['fromName'])) {
             $fromName = $params['fromName'];
         } else {
             $fromName = $config->get('outboundEmailFromName');
         }
         $message->addFrom(trim($email->get('from')), $fromName);
     } else {
         if (!empty($params['fromAddress'])) {
             $fromAddress = $params['fromAddress'];
         } else {
             if (!$config->get('outboundEmailFromAddress')) {
                 throw new Error('outboundEmailFromAddress is not specified in config.');
             }
             $fromAddress = $config->get('outboundEmailFromAddress');
         }
         if (!empty($params['fromName'])) {
             $fromName = $params['fromName'];
         } else {
             $fromName = $config->get('outboundEmailFromName');
         }
         $message->addFrom($fromAddress, $fromName);
     }
     if (!$email->get('from')) {
         $email->set('from', $fromAddress);
     }
     if (!empty($params['replyToAddress'])) {
         $replyToName = null;
         if (!empty($params['replyToName'])) {
             $replyToName = $params['replyToName'];
         }
         $message->setReplyTo($params['replyToAddress'], $replyToName);
     }
     $value = $email->get('to');
     if ($value) {
         $arr = explode(';', $value);
         if (is_array($arr)) {
             foreach ($arr as $address) {
                 $message->addTo(trim($address));
             }
         }
     }
     $value = $email->get('cc');
     if ($value) {
         $arr = explode(';', $value);
         if (is_array($arr)) {
             foreach ($arr as $address) {
                 $message->addCC(trim($address));
             }
         }
     }
     $value = $email->get('bcc');
     if ($value) {
         $arr = explode(';', $value);
         if (is_array($arr)) {
             foreach ($arr as $address) {
                 $message->addBCC(trim($address));
             }
         }
     }
     $value = $email->get('replyTo');
     if ($value) {
         $arr = explode(';', $value);
         if (is_array($arr)) {
             foreach ($arr as $address) {
                 $message->addReplyTo(trim($address));
             }
         }
     }
     $attachmentPartList = array();
     $attachmentCollection = $email->get('attachments');
     $attachmentInlineCollection = $email->getInlineAttachments();
     foreach ($attachmetList as $attachment) {
         $attachmentCollection[] = $attachment;
     }
     if (!empty($attachmentCollection)) {
         foreach ($attachmentCollection as $a) {
             $fileName = 'data/upload/' . $a->id;
             $attachment = new MimePart(file_get_contents($fileName));
             $attachment->disposition = Mime::DISPOSITION_ATTACHMENT;
             $attachment->encoding = Mime::ENCODING_BASE64;
             $attachment->filename = $a->get('name');
             if ($a->get('type')) {
                 $attachment->type = $a->get('type');
             }
             $attachmentPartList[] = $attachment;
         }
     }
     if (!empty($attachmentInlineCollection)) {
         foreach ($attachmentInlineCollection as $a) {
             $fileName = 'data/upload/' . $a->id;
             $attachment = new MimePart(file_get_contents($fileName));
//.........这里部分代码省略.........
开发者ID:chinazan,项目名称:zzcrm,代码行数:101,代码来源:Sender.php


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