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


PHP PHPMailer::AddCc方法代码示例

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


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

示例1: foreach

// Set mail's subject and body
$phpmailer->Subject = $subject;
$phpmailer->Body = $message;
// Add any CC and BCC recipients
if (!empty($cc)) {
    foreach ((array) $cc as $recipient) {
        try {
            // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
            $recipient_name = '';
            if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
                if (count($matches) == 3) {
                    $recipient_name = $matches[1];
                    $recipient = $matches[2];
                }
            }
            $phpmailer->AddCc($recipient, $recipient_name);
        } catch (phpmailerException $e) {
            continue;
        }
    }
}
if (!empty($bcc)) {
    foreach ((array) $bcc as $recipient) {
        try {
            // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
            $recipient_name = '';
            if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
                if (count($matches) == 3) {
                    $recipient_name = $matches[1];
                    $recipient = $matches[2];
                }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:31,代码来源:function.wp_mail.php

示例2: array


//.........这里部分代码省略.........
     if (!is_array($to)) {
         $to = explode(',', $to);
     }
     foreach ((array) $to as $recipient) {
         try {
             // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
             $recipient_name = '';
             if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
                 if (count($matches) == 3) {
                     $recipient_name = $matches[1];
                     $recipient = $matches[2];
                 }
             }
             $phpmailer->AddAddress($recipient, $recipient_name);
         } catch (phpmailerException $e) {
             continue;
         }
     }
     // Set mail's subject and body
     $phpmailer->Subject = $subject;
     $phpmailer->Body = $message;
     // Add any CC and BCC recipients
     if (!empty($cc)) {
         foreach ((array) $cc as $recipient) {
             try {
                 // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
                 $recipient_name = '';
                 if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
                     if (count($matches) == 3) {
                         $recipient_name = $matches[1];
                         $recipient = $matches[2];
                     }
                 }
                 $phpmailer->AddCc($recipient, $recipient_name);
             } catch (phpmailerException $e) {
                 continue;
             }
         }
     }
     if (!empty($bcc)) {
         foreach ((array) $bcc as $recipient) {
             try {
                 // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
                 $recipient_name = '';
                 if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
                     if (count($matches) == 3) {
                         $recipient_name = $matches[1];
                         $recipient = $matches[2];
                     }
                 }
                 $phpmailer->AddBcc($recipient, $recipient_name);
             } catch (phpmailerException $e) {
                 continue;
             }
         }
     }
     // Set to use PHP's mail()
     $phpmailer->IsMail();
     // Set Content-Type and charset
     // If we don't have a content-type from the input headers
     if (!isset($content_type)) {
         $content_type = 'text/plain';
     }
     /**
      * Filter the wp_mail() content type.
      *
开发者ID:cybKIRA,项目名称:roverlink-updated,代码行数:67,代码来源:pluggable.php

示例3: array


//.........这里部分代码省略.........
                             $boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset));
                             $charset = '';
                         }
                     } else {
                         $content_type = trim($content);
                     }
                 } elseif ('cc' == strtolower($name)) {
                     $cc = explode(",", $content);
                 } elseif ('bcc' == strtolower($name)) {
                     $bcc = explode(",", $content);
                 } else {
                     // Add it to our grand headers array
                     $headers[trim($name)] = trim($content);
                 }
             }
         }
     }
     // Empty out the values that may be set
     $bb_phpmailer->ClearAddresses();
     $bb_phpmailer->ClearAllRecipients();
     $bb_phpmailer->ClearAttachments();
     $bb_phpmailer->ClearBCCs();
     $bb_phpmailer->ClearCCs();
     $bb_phpmailer->ClearCustomHeaders();
     $bb_phpmailer->ClearReplyTos();
     // From email and name
     // If we don't have a name from the input headers
     if (!isset($from_name)) {
         $from_name = bb_get_option('name');
     }
     // If we don't have an email from the input headers
     if (!isset($from_email)) {
         $from_email = bb_get_option('from_email');
     }
     // If there is still no email address
     if (!$from_email) {
         // Get the site domain and get rid of www.
         $sitename = strtolower($_SERVER['SERVER_NAME']);
         if (substr($sitename, 0, 4) == 'www.') {
             $sitename = substr($sitename, 4);
         }
         $from_email = 'bbpress@' . $sitename;
     }
     // Plugin authors can override the potentially troublesome default
     $bb_phpmailer->From = apply_filters('bb_mail_from', $from_email);
     $bb_phpmailer->FromName = apply_filters('bb_mail_from_name', $from_name);
     // Set destination address
     $bb_phpmailer->AddAddress($to);
     // Set mail's subject and body
     $bb_phpmailer->Subject = $subject;
     $bb_phpmailer->Body = $message;
     // Add any CC and BCC recipients
     if (!empty($cc)) {
         foreach ((array) $cc as $recipient) {
             $bb_phpmailer->AddCc(trim($recipient));
         }
     }
     if (!empty($bcc)) {
         foreach ((array) $bcc as $recipient) {
             $bb_phpmailer->AddBcc(trim($recipient));
         }
     }
     // Set to use PHP's mail()
     $bb_phpmailer->IsMail();
     // Set Content-Type and charset
     // If we don't have a content-type from the input headers
     if (!isset($content_type)) {
         $content_type = 'text/plain';
     }
     $content_type = apply_filters('bb_mail_content_type', $content_type);
     $bb_phpmailer->ContentType = $content_type;
     // Set whether it's plaintext or not, depending on $content_type
     if ($content_type == 'text/html') {
         $bb_phpmailer->IsHTML(true);
     }
     // If we don't have a charset from the input headers
     if (!isset($charset)) {
         $charset = bb_get_option('charset');
     }
     // Set the content-type and charset
     $bb_phpmailer->CharSet = apply_filters('bb_mail_charset', $charset);
     // Set custom headers
     if (!empty($headers)) {
         foreach ((array) $headers as $name => $content) {
             $bb_phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content));
         }
         if (false !== stripos($content_type, 'multipart') && !empty($boundary)) {
             $bb_phpmailer->AddCustomHeader(sprintf("Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary));
         }
     }
     if (!empty($attachments)) {
         foreach ($attachments as $attachment) {
             $bb_phpmailer->AddAttachment($attachment);
         }
     }
     do_action_ref_array('bb_phpmailer_init', array(&$bb_phpmailer));
     // Send!
     $result = @$bb_phpmailer->Send();
     return $result;
 }
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:101,代码来源:functions.bb-pluggable.php

示例4: extract


//.........这里部分代码省略.........
                         $from_name = substr($content, 0, strpos($content, '<') - 1);
                         $from_name = str_replace('"', '', $from_name);
                         $from_name = trim($from_name);
                         $from_email = substr($content, strpos($content, '<') + 1);
                         $from_email = str_replace('>', '', $from_email);
                         $from_email = trim($from_email);
                     } else {
                         $from_name = trim($content);
                     }
                 } elseif ('content-type' == strtolower($name)) {
                     if (strpos($content, ';') !== false) {
                         list($type, $charset) = explode(';', $content);
                         $content_type = trim($type);
                         $charset = trim(str_replace(array('charset=', '"'), '', $charset));
                     } else {
                         $content_type = trim($content);
                     }
                 } elseif ('cc' == strtolower($name)) {
                     $cc = explode(",", $content);
                 } elseif ('bcc' == strtolower($name)) {
                     $bcc = explode(",", $content);
                 } else {
                     // Add it to our grand headers array
                     $headers[trim($name)] = trim($content);
                 }
             }
         }
     }
     // Empty out the values that may be set
     $phpmailer->ClearAddresses();
     $phpmailer->ClearAllRecipients();
     $phpmailer->ClearAttachments();
     $phpmailer->ClearBCCs();
     $phpmailer->ClearCCs();
     $phpmailer->ClearCustomHeaders();
     $phpmailer->ClearReplyTos();
     // From email and name
     // If we don't have a name from the input headers
     if (!isset($from_name)) {
         $from_name = 'WordPress';
     }
     // If we don't have an email from the input headers
     if (!isset($from_email)) {
         // Get the site domain and get rid of www.
         $sitename = strtolower($_SERVER['SERVER_NAME']);
         if (substr($sitename, 0, 4) == 'www.') {
             $sitename = substr($sitename, 4);
         }
         $from_email = 'wordpress@' . $sitename;
     }
     // Set the from name and email
     $phpmailer->From = apply_filters('wp_mail_from', $from_email);
     $phpmailer->FromName = apply_filters('wp_mail_from_name', $from_name);
     // Set destination address
     $phpmailer->AddAddress($to);
     // Set mail's subject and body
     $phpmailer->Subject = $subject;
     $phpmailer->Body = $message;
     // Add any CC and BCC recipients
     if (!empty($cc)) {
         foreach ($cc as $recipient) {
             $phpmailer->AddCc(trim($recipient));
         }
     }
     if (!empty($bcc)) {
         foreach ($bcc as $recipient) {
             $phpmailer->AddBcc(trim($recipient));
         }
     }
     // Set to use PHP's mail()
     $phpmailer->IsMail();
     // Set Content-Type and charset
     // If we don't have a content-type from the input headers
     if (!isset($content_type)) {
         $content_type = 'text/plain';
     }
     $content_type = apply_filters('wp_mail_content_type', $content_type);
     // Set whether it's plaintext or not, depending on $content_type
     if ($content_type == 'text/html') {
         $phpmailer->IsHTML(true);
     } else {
         $phpmailer->IsHTML(false);
     }
     // If we don't have a charset from the input headers
     if (!isset($charset)) {
         $charset = get_bloginfo('charset');
     }
     // Set the content-type and charset
     $phpmailer->CharSet = apply_filters('wp_mail_charset', $charset);
     // Set custom headers
     if (!empty($headers)) {
         foreach ($headers as $name => $content) {
             $phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content));
         }
     }
     do_action_ref_array('phpmailer_init', array(&$phpmailer));
     // Send!
     $result = @$phpmailer->Send();
     return $result;
 }
开发者ID:nurpax,项目名称:saastafi,代码行数:101,代码来源:pluggable.php

示例5: mail_it


//.........这里部分代码省略.........
            }
            if (isset($_POST['SMTPAuth']) && ($_POST['SMTPAuth'] === true || $_POST['SMTPAuth'] === false)) {
                $mail->SMTPAuth = $_POST['SMTPAuth'];
            }
            if (isset($_POST['Username']) && trim($_POST['Username']) != "") {
                $mail->Username = trim($_POST['Username']);
            }
            if (isset($_POST['Username']) && trim($_POST['Username']) != "") {
                $mail->Password = trim($_POST['Password']);
            }
            if (isset($_POST['Timeout']) && trim($_POST['Timeout']) != "") {
                $mail->Timeout = trim($_POST['Timeout']);
            }
        } elseif (isset($_POST['Mailer']) && strtolower(trim($_POST['Mailer'])) == "sendmail") {
            $mail->IsSendmail();
        } elseif (isset($_POST['Mailer']) && strtolower(trim($_POST['Mailer'])) == "qmail") {
            $mail->IsQmail();
        }
        if (isset($_POST['fixedFromEmail'])) {
            if (isset($_POST['fixedFromName']) && trim($_POST['fixedFromName']) == '') {
                $_POST['fixedFromName'] = $_POST['fixedFromEmail'];
            }
            if (stristr($mail->Version, '5.1')) {
                $mail->SetFrom($_POST['fixedFromEmail'], $_POST['fixedFromName']);
            } elseif (stristr($mail->Version, '5')) {
                $mail->SetFrom($_POST['fixedFromEmail'], $_POST['fixedFromName']);
                $mail->AddReplyTo($_POST['fixedFromEmail'], $_POST['fixedFromName']);
            } else {
                $mail->SetFrom($_POST['fixedFromEmail'], $_POST['fixedFromName']);
            }
        } else {
            if (!isset($realname) && trim($realname) == '') {
                $realname = $email;
            }
            if (stristr($mail->Version, '5.1')) {
                $mail->SetFrom($email, $realname);
            } elseif ($mail->Version >= 5) {
                $mail->SetFrom($email, $realname);
                $mail->AddReplyTo($email, $realname);
            } else {
                $mail->From = $email;
                $mail->FromName = $realname;
            }
        }
        $mail->Subject = $subject;
        $mail->AddAddress($recipient);
        if ($bcc) {
            if (strpos($bcc, ",") || strpos($bcc, ";")) {
                $bcc_in = explode(',', $bcc);
                foreach ($bcc_in as $key => $value) {
                    $mail->AddBcc($value);
                }
            } else {
                $mail->AddBcc($bcc);
            }
        }
        if ($cc) {
            if (strpos($cc, ",") || strpos($cc, ";")) {
                $cc_in = explode(',', $cc);
                foreach ($cc_in as $key => $value) {
                    $mail->AddCc($value);
                }
            } else {
                $mail->AddCc($cc);
            }
        }
        $mail->MsgHTML($content["html"]);
        $mail->AltBody = _html2txt($content['html']);
        if ($attachment_name && $inbound) {
            //Add attachment function is in phpmailer
            //reset the arrays to the top
            reset($attachment_name);
            reset($attachment_temp);
            //loop through the arrays to get the attached file names and attach each one.
            while ((list($key1, $val1) = each($attachment_name)) && (list($key2, $val2) = each($attachment_temp))) {
                $atchmnt = file_get_contents($val2);
                $mail->AddStringAttachment($atchmnt, $val1);
            }
        } else {
            if ($local_name && $inbound === false) {
                $mail->AddAttachment($local_temp, $local_name);
            }
        }
        if ($mail->Send()) {
            echo '<script type="text/javascript">document.getElementById("feprocessing").src="_src/complete.gif";</script>';
            $valSent = true;
        }
    } else {
        if (@mail($recipient, $subject, $mail_message, $mail_headers)) {
            echo '<script type="text/javascript">document.getElementById("feprocessing").src="_src/complete.gif";</script>';
            $valSent = true;
        }
    }
    if ($addToCSV) {
        $writeVal = _writeLine($subject, $content['csv']);
    }
    if ($valSent) {
        return true;
    }
}
开发者ID:VicenteTerra,项目名称:validarec,代码行数:101,代码来源:phpmailer-fe.php

示例6: array


//.........这里部分代码省略.........
     $phpmailer->ClearReplyTos();
     // From email and name
     // If we don't have a name from the input headers
     if (!isset($from_name)) {
         $from_name = 'WordPress';
     }
     /* If we don't have an email from the input headers default to wordpress@$sitename
      * Some hosts will block outgoing mail from this address if it doesn't exist but
      * there's no easy alternative. Defaulting to admin_email might appear to be another
      * option but some hosts may refuse to relay mail from an unknown domain. See
      * http://trac.wordpress.org/ticket/5007.
      */
     if (!isset($from_email)) {
         // Get the site domain and get rid of www.
         $sitename = strtolower($_SERVER['SERVER_NAME']);
         if (substr($sitename, 0, 4) == 'www.') {
             $sitename = substr($sitename, 4);
         }
         $from_email = 'wordpress@' . $sitename;
     }
     // Plugin authors can override the potentially troublesome default
     $phpmailer->From = apply_filters('wp_mail_from', $from_email);
     $phpmailer->FromName = apply_filters('wp_mail_from_name', $from_name);
     // Set destination addresses
     if (!is_array($to)) {
         $to = explode(',', $to);
     }
     foreach ((array) $to as $recipient) {
         $phpmailer->AddAddress(trim($recipient));
     }
     // Set mail's subject and body
     $phpmailer->Subject = $subject;
     $phpmailer->Body = $message;
     // Add any CC and BCC recipients
     if (!empty($cc)) {
         foreach ((array) $cc as $recipient) {
             $phpmailer->AddCc(trim($recipient));
         }
     }
     if (!empty($bcc)) {
         foreach ((array) $bcc as $recipient) {
             $phpmailer->AddBcc(trim($recipient));
         }
     }
     if (!empty($message_id)) {
         $phpmailer->MessageID = $message_id;
     }
     // Set to use PHP's mail()
     $phpmailer->IsMail();
     // SupportPress: use STMP if configured
     if (defined('SMTP_HOST') && SMTP_HOST) {
         $phpmailer->IsSMTP();
         $phpmailer->Host = SMTP_HOST;
         if (SMTP_PORT) {
             $phpmailer->Host .= ':' . SMTP_PORT;
         }
         global $email_domain;
         $phpmailer->Hostname = $email_domain;
         if (SMTP_USER) {
             $phpmailer->SMTPAuth = true;
             $phpmailer->Username = SMTP_USER;
             $phpmailer->Password = SMTP_PASSWORD;
         }
     }
     // Set Content-Type and charset
     // If we don't have a content-type from the input headers
     if (!isset($content_type)) {
         $content_type = 'text/plain';
     }
     $content_type = apply_filters('wp_mail_content_type', $content_type);
     $phpmailer->ContentType = $content_type;
     // Set whether it's plaintext, depending on $content_type
     if ('text/html' == $content_type) {
         $phpmailer->IsHTML(true);
     }
     // If we don't have a charset from the input headers
     if (!isset($charset)) {
         $charset = 'utf-8';
     }
     // Set the content-type and charset
     $phpmailer->CharSet = apply_filters('wp_mail_charset', $charset);
     // Set custom headers
     if (!empty($headers)) {
         foreach ((array) $headers as $name => $content) {
             $phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content));
         }
         if (false !== stripos($content_type, 'multipart') && !empty($boundary)) {
             $phpmailer->AddCustomHeader(sprintf("Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary));
         }
     }
     if (!empty($attachments)) {
         foreach ($attachments as $attachment) {
             $phpmailer->AddAttachment($attachment);
         }
     }
     do_action_ref_array('phpmailer_init', array(&$phpmailer));
     // Send!
     $result = @$phpmailer->Send();
     return $result;
 }
开发者ID:bi0xid,项目名称:bach,代码行数:101,代码来源:wp-functions.php

示例7: array


//.........这里部分代码省略.........
     // If we don't have a charset from the input headers
     if (!isset($charset)) {
         $charset = get_bloginfo('charset');
     }
     // Set the content-type and charset
     $phpmailer->CharSet = apply_filters('wp_mail_charset', $charset);
     // Set mail's subject and body
     $phpmailer->Subject = $subject;
     if (is_string($message)) {
         $phpmailer->Body = $message;
         // Set Content-Type and charset
         // If we don't have a content-type from the input headers
         if (!isset($content_type)) {
             $content_type = 'text/plain';
         }
         $content_type = apply_filters('wp_mail_content_type', $content_type);
         $phpmailer->ContentType = $content_type;
         // Set whether it's plaintext, depending on $content_type
         if ('text/html' == $content_type) {
             $phpmailer->IsHTML(true);
         }
         // For backwards compatibility, new multipart emails should use
         // the array style $message. This never really worked well anyway
         if (false !== stripos($content_type, 'multipart') && !empty($boundary)) {
             $phpmailer->AddCustomHeader(sprintf("Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary));
         }
     } elseif (is_array($message)) {
         foreach ($message as $type => $bodies) {
             foreach ((array) $bodies as $body) {
                 if ($type === 'text/html') {
                     $phpmailer->Body = $body;
                 } elseif ($type === 'text/plain') {
                     $phpmailer->AltBody = $body;
                 } else {
                     $phpmailer->AddAttachment($body, '', 'base64', $type);
                 }
             }
         }
     }
     // Add any CC and BCC recipients
     if (!empty($cc)) {
         foreach ((array) $cc as $recipient) {
             try {
                 // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
                 $recipient_name = '';
                 if (preg_match('/(.+)\\s?<(.+)>/', $recipient, $matches)) {
                     if (count($matches) == 3) {
                         $recipient_name = $matches[1];
                         $recipient = $matches[2];
                     }
                 }
                 $phpmailer->AddCc(trim($recipient), $recipient_name);
             } catch (phpmailerException $e) {
                 continue;
             }
         }
     }
     if (!empty($bcc)) {
         foreach ((array) $bcc as $recipient) {
             try {
                 // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
                 $recipient_name = '';
                 if (preg_match('/(.+)\\s?<(.+)>/', $recipient, $matches)) {
                     if (count($matches) == 3) {
                         $recipient_name = $matches[1];
                         $recipient = $matches[2];
                     }
                 }
                 $phpmailer->AddBcc(trim($recipient), $recipient_name);
             } catch (phpmailerException $e) {
                 continue;
             }
         }
     }
     // Set to use PHP's mail()
     $phpmailer->IsMail();
     // Set custom headers
     if (!empty($headers)) {
         foreach ((array) $headers as $name => $content) {
             $phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content));
         }
     }
     if (!empty($attachments)) {
         foreach ($attachments as $attachment) {
             try {
                 $phpmailer->AddAttachment($attachment);
             } catch (phpmailerException $e) {
                 continue;
             }
         }
     }
     do_action_ref_array('phpmailer_init', array(&$phpmailer));
     // Send!
     try {
         $phpmailer->Send();
     } catch (phpmailerException $e) {
         return false;
     }
     return true;
 }
开发者ID:rbredow,项目名称:allyzabbacart,代码行数:101,代码来源:wp_mail.php

示例8: bp_email

 /**
  * Send email(s).
  *
  * @since 2.5.0
  *
  * @param BP_Email $email Email to send.
  * @return bool|WP_Error Returns true if email send, else a descriptive WP_Error.
  */
 public function bp_email(BP_Email $email)
 {
     static $phpmailer = null;
     if ($phpmailer === null) {
         if (!class_exists('PHPMailer')) {
             require_once ABSPATH . WPINC . '/class-phpmailer.php';
             require_once ABSPATH . WPINC . '/class-smtp.php';
         }
         $phpmailer = new PHPMailer(true);
     }
     /*
      * Resets.
      */
     $phpmailer->clearAllRecipients();
     $phpmailer->clearAttachments();
     $phpmailer->clearCustomHeaders();
     $phpmailer->clearReplyTos();
     $phpmailer->Sender = '';
     /*
      * Set up.
      */
     $phpmailer->IsMail();
     $phpmailer->CharSet = bp_get_option('blog_charset');
     $phpmailer->Hostname = self::get_hostname();
     /*
      * Content.
      */
     $phpmailer->Subject = $email->get_subject('replace-tokens');
     $content_plaintext = PHPMailer::normalizeBreaks($email->get_content_plaintext('replace-tokens'));
     if ($email->get('content_type') === 'html') {
         $phpmailer->msgHTML($email->get_template('add-content'), '', 'wp_strip_all_tags');
         $phpmailer->AltBody = $content_plaintext;
     } else {
         $phpmailer->IsHTML(false);
         $phpmailer->Body = $content_plaintext;
     }
     $recipient = $email->get_from();
     try {
         $phpmailer->SetFrom($recipient->get_address(), $recipient->get_name(), false);
     } catch (phpmailerException $e) {
     }
     $recipient = $email->get_reply_to();
     try {
         $phpmailer->addReplyTo($recipient->get_address(), $recipient->get_name());
     } catch (phpmailerException $e) {
     }
     $recipients = $email->get_to();
     foreach ($recipients as $recipient) {
         try {
             $phpmailer->AddAddress($recipient->get_address(), $recipient->get_name());
         } catch (phpmailerException $e) {
         }
     }
     $recipients = $email->get_cc();
     foreach ($recipients as $recipient) {
         try {
             $phpmailer->AddCc($recipient->get_address(), $recipient->get_name());
         } catch (phpmailerException $e) {
         }
     }
     $recipients = $email->get_bcc();
     foreach ($recipients as $recipient) {
         try {
             $phpmailer->AddBcc($recipient->get_address(), $recipient->get_name());
         } catch (phpmailerException $e) {
         }
     }
     $headers = $email->get_headers();
     foreach ($headers as $name => $content) {
         $phpmailer->AddCustomHeader($name, $content);
     }
     /**
      * Fires after PHPMailer is initialised.
      *
      * @since 2.5.0
      *
      * @param PHPMailer $phpmailer The PHPMailer instance.
      */
     do_action('bp_phpmailer_init', $phpmailer);
     /** This filter is documented in wp-includes/pluggable.php */
     do_action_ref_array('phpmailer_init', array(&$phpmailer));
     try {
         return $phpmailer->Send();
     } catch (phpmailerException $e) {
         return new WP_Error($e->getCode(), $e->getMessage(), $email);
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:95,代码来源:class-bp-phpmailer.php

示例9:

        $mail->SMTPSecure = "ssl";
        // sets the prefix to the servier
        $mail->Host = "smtp.gmail.com";
        // we use GMAIL as the SMTP server
        $mail->Port = 465;
        // set the SMTP port for the GMAIL server
        $mail->Username = "webadmin@computradetech.com";
        // GMAIL username
        $mail->Password = "admincti";
        // GMAIL password
        $mail->SetFrom('webadmin@computradetech.com', $email);
        $mail->Subject = "Helios - " . $subject;
        $mail->AltBody = "To view the message, please use an HTML compatible mail viewer!";
        // optional, comment out and test
        $mail->AddAddress('info@heliosinformatika.com');
        $mail->AddCc('marketing@computradetech.com');
        if (!$mail->Send()) {
            echo "Mailer Error: " . $mail->ErrorInfo;
        } else {
            if (save_record($salutation, $name, $title, $company, $industry, $code1, $code2, $region, $phone, $mobile, $email, $subject, $message, $datepost)) {
                $end_message = "<div class='alert alert-success alert-dismissable'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tThank you. your comment has been saved! </div>";
            } else {
                $end_message = "<div class='alert alert-warning alert-dismissable'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t  <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t  <strong>Sorry! </strong>your comment is not saved!</div>";
            }
        }
    }
}
?>
<div class="container overview2">
	<div class="container overviewmidle">
		<div class="col-lg-12">
开发者ID:hunterbudi,项目名称:heliosinformatika,代码行数:31,代码来源:contact.php


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