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