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


PHP phpmailer::AddCc方法代码示例

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


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

示例1: send

 /**
  * Send mail, similar to PHP's mail
  *
  * A true return value does not automatically mean that the user received the
  * email successfully. It just only means that the method used was able to
  * process the request without any errors.
  *
  * The default content type is 'text/plain' which does not allow using HTML.
  */
 public static function send($from_email, $from_name, array $to, $subject, $message, array $cc = array(), array $bcc = array(), array $attachments = array())
 {
     $mailer = new phpmailer();
     $content_type = 'text/plain';
     $mailer->ContentType = $content_type;
     $mailer->Hostname = \lib\conf\constants::$domain;
     $mailer->IsMail();
     $mailer->IsHTML(false);
     $mailer->From = $from_email;
     $mailer->FromName = $from_name;
     // add recipients
     foreach ((array) $to as $recipient_name => $recipient_email) {
         $mailer->AddAddress(trim($recipient_email), trim($recipient_name));
     }
     // Add any CC and BCC recipients
     foreach ($cc as $recipient_name => $recipient_email) {
         $mailer->AddCc(trim($recipient_email), trim($recipient_name));
     }
     foreach ($bcc as $recipient_name => $recipient_email) {
         $mailer->AddBcc(trim($recipient_email), trim($recipient_name));
     }
     // Set mail's subject and body
     $mailer->Subject = $subject;
     $mailer->Body = $message;
     foreach ($attachments as $attachment) {
         $mailer->AddAttachment($attachment);
     }
     // Send!
     $result = $mailer->Send();
     return $result;
 }
开发者ID:revcozmo,项目名称:dating,代码行数:40,代码来源:mail.php


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