本文整理汇总了PHP中PHPMailer::addBCC方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::addBCC方法的具体用法?PHP PHPMailer::addBCC怎么用?PHP PHPMailer::addBCC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::addBCC方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: email
/**
* email function
*
* @return bool | void
**/
function email($to, $from_mail, $from_name, $subject, $message)
{
require '../../PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->From = $from_mail;
$mail->FromName = $from_name;
$mail->addAddress($to, $from_name);
// Add a recipient
$mail->addCC('');
//Optional ; Use for CC
$mail->addBCC('');
//Optional ; Use for BCC
$mail->WordWrap = 50;
// Set word wrap to 50 characters
$mail->isHTML(true);
// Set email format to HTML
//Remove below comment out code for SMTP stuff, otherwise don't touch this code.
/*
$mail->isSMTP();
$mail->Host = "mail.example.com"; //Set the hostname of the mail server
$mail->Port = 25; //Set the SMTP port number - likely to be 25, 465 or 587
$mail->SMTPAuth = true; //Whether to use SMTP authentication
$mail->Username = "yourname@example.com"; //Username to use for SMTP authentication
$mail->Password = "yourpassword"; //Password to use for SMTP authentication
*/
$mail->Subject = $subject;
$mail->Body = $message;
if ($mail->send()) {
return true;
}
}
示例2: sendMail
function sendMail($email, $subject, $body)
{
//function parameters, 3 variables.
$mail = new PHPMailer();
$mail->IsSMTP();
//$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->Host = "smtp.gmail.com";
$mail->Username = "ifsworld88@gmail.com";
$mail->Password = "ifs@1234";
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->From = "ifsworld88@gmail.com";
$mail->FromName = "IFS R&D International";
$mail->AddReplyTo("ifsworld88@gmail.com", "IFS");
//$mail->AddAddress("fshalika.fdo@gmail.com","shalika");
//$mail->AddAddress("shalikafernando9@gmail.com","shalika");
$mail->addBCC("{$email}");
$mail->WordWrap = 50;
$mail->IsHTML(true);
//$mail->addAttachment('images/ifs.png','ifs.png');//if needed
$mail->Subject = $subject;
$mail->Body = $body;
$_SESSION["mail"] = "";
if ($mail->send()) {
echo "sent mail";
//$_SESSION["mail"] = "success";
//setcookie("mail", "Success");
} else {
echo "send mail failed" . $mail->ErrorInfo;
//$_SESSION["mail"] = "failed";
//setcookie("mail", "Failed");
}
}
示例3: send
function send()
{
$registry = Registry::getInstance();
$site_root_absolute = $registry->get('site_root_absolute');
$mail = new PHPMailer();
# $mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP();
// Set mailer to use SMTP
$mail->Host = 'smtp-relay.gmail.com;smtp.gmail.com';
// Specify main and backup SMTP servers
# $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true;
// Enable SMTP authentication
$mail->Username = 'info@mmotoracks.com';
// SMTP username
$mail->Password = 'mmotoracks321';
// SMTP password
$mail->SMTPSecure = 'tls';
// Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;
// TCP port to connect to
$mail->isHTML(true);
// Set email format to HTML
$mail->setFrom($this->from);
$mail->addAddress($this->to);
// Add a recipient
# $mail->addAddress('ellen@example.com'); // Name is optional
if ($this->reply) {
$mail->addReplyTo($this->reply);
}
# $mail->addCC('cc@example.com');
$mail->addBCC('mmoto@jne21.com');
$mail->Subject = $this->subject;
$mail->Body = $this->html;
$mail->AltBody = $this->text;
if (is_array($this->attachments)) {
foreach ($this->attachments as $attach) {
$mail->addAttachment($site_root_absolute . self::BASE_PATH . $this->id . EmailTemplateAttahchment::PATH . $attach->filename);
}
}
if (is_array($this->images)) {
foreach ($this->images as $image) {
$mail->addAttachment($site_root_absolute . self::BASE_PATH . $this->id . EmailTemplateEmbedded::PATH . $image->filename, $image->cid, 'base64', null, 'inline');
}
}
foreach ($this->makeHeaders($this->headers) as $name => $value) {
$mail->addCustomHeader($name, $value);
}
$result = $mail->send();
if (!$result) {
$this->errorInfo = $mail->ErrorInfo;
}
return $result;
}
示例4: bcc
/**
* Adds to the "Bcc" recipient collection.
*
* @param mixed $RecipientEmail An email (or array of emails) to add to the "Bcc" recipient collection.
* @param string $RecipientName The recipient name associated with $RecipientEmail. If $RecipientEmail is
* an array of email addresses, this value will be ignored.
* @return Email
*/
public function bcc($RecipientEmail, $RecipientName = '')
{
ob_start();
$this->PhpMailer->addBCC($RecipientEmail, $RecipientName);
ob_end_clean();
return $this;
}
示例5: bcc
/**
* Adds to the "Bcc" recipient collection.
*
* @param mixed $RecipientEmail An email (or array of emails) to add to the "Bcc" recipient collection.
* @param string $RecipientName The recipient name associated with $RecipientEmail. If $RecipientEmail is
* an array of email addresses, this value will be ignored.
* @return Email
*/
public function bcc($RecipientEmail, $RecipientName = '')
{
if ($RecipientName != '' && c('Garden.Email.OmitToName', false)) {
$RecipientName = '';
}
ob_start();
$this->PhpMailer->addBCC($RecipientEmail, $RecipientName);
ob_end_clean();
return $this;
}
示例6: enviarMail
public function enviarMail($body, $CabPed)
{
$msg = new VSexception();
$mail = new PHPMailer();
//$body = "Hola como estas";
$mail->IsSMTP();
//Para tls
//$mail->SMTPSecure = 'tls';
//$mail->Port = 587;
//Para ssl
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
// la dirección del servidor, p. ej.: smtp.servidor.com
$mail->Host = "mail.utimpor.com";
// dirección remitente, p. ej.: no-responder@miempresa.com
// nombre remitente, p. ej.: "Servicio de envío automático"
$mail->setFrom('no-responder@utimpor.com', 'Servicio de envío automático Utimpor.com');
//$mail->setFrom('bvillacreses@utimpor.com', 'Utimpor.com');
// asunto y cuerpo alternativo del mensaje
$mail->Subject = "Ha Recibido un(a) Orden Nuevo(a)!!!";
$mail->AltBody = "Data alternativao";
// si el cuerpo del mensaje es HTML
$mail->MsgHTML($body);
// podemos hacer varios AddAdress
$mail->AddAddress($CabPed[0]["CorreoUser"], $CabPed[0]["NombreUser"]);
//Usuario Autoriza Pedido
$mail->AddAddress($CabPed[0]["CorreoPersona"], $CabPed[0]["NombrePersona"]);
//Usuario Genera Pedido
//$mail->AddAddress("byron_villacresesf@hotmail.com", "Byron Villa");
//$mail->AddAddress("byronvillacreses@gmail.com", "Byron Villa");
/******** COPIA OCULTA PARA VENTAS ***************/
$mail->addBCC('ventas@utimpor.com', 'Ventas Utimpor');
//Para copia Oculta
//$mail->addBCC('ventas2@utimpor.com', 'Ventas Utimpor'); //Para copia Oculta
$mail->addBCC('yalava@utimpor.com', 'Ventas Utimpor');
//Para copia Oculta
$mail->addBCC('byronvillacreses@gmail.com', 'Byron Villa');
//Para con copia
//$mail->addCC('byronvillacreses@gmail.com', 'ByronV'); //Para con copia
//$mail->addReplyTo('byronvillacreses@gmail.com', 'First Last');
//
// si el SMTP necesita autenticación
$mail->SMTPAuth = true;
// credenciales usuario
$mail->Username = $this->noResponder;
$mail->Password = $this->noResponderPass;
$mail->CharSet = $this->charSet;
if (!$mail->Send()) {
//echo "Error enviando: " . $mail->ErrorInfo;
return $msg->messageSystem('NO_OK', "Error enviando: " . $mail->ErrorInfo, 11, null, null);
} else {
//echo "¡¡Enviado!!";
return $msg->messageSystem('OK', "¡¡Enviado!!", 30, null, null);
}
}
示例7: sendEmail
public function sendEmail($params)
{
$mail = new PHPMailer();
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP();
// Set mailer to use SMTP
$mail->Host = 'smtp.mailgun.org';
// Specify main and backup SMTP servers
$mail->SMTPAuth = true;
// Enable SMTP authentication
$mail->Username = 'postmaster@sandbox9b23acb4dacc4962a6a02153fe2cb923.mailgun.org';
// SMTP username
$mail->Password = '66a62590b2b25fbfb8c97869243e7831';
// SMTP password
$mail->SMTPSecure = 'tls';
// Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;
// TCP port to connect to
$mail->From = 'becas@jusbaires.gov.ar';
$mail->FromName = 'Becas';
//$email = $params['email']."@jusbaires.gov.ar";
$email = $params['email'];
$mail->addAddress($email);
// Por ahora lo saco de parametros
$mail->addReplyTo('becas@jusbaires.gov.ar', 'Cursos');
$mail->addBCC('gcaserotto@jusbaires.gov.ar');
$mail->addBCC('cursos@jusbaires.gov.ar');
$mail->isHTML(true);
// Set email format to HTML
$mail->Subject = 'Solicitud de Beca';
$mail->Body = 'Estimado/a: ' . $params['nombre'] . ',<br>
<p style="font-size:22px">
Para validar su solicitud de beca <a href="http://cfj.gov.ar/test/becas/confirma_solicitud.php?a=' . $params['md5'] . '" style="color:red;">
confirme su correo electrónico aquí</a>
<p>
<p style="font-size:22px">
A los efectos de completar su solicitud deberá imprimir el formulario e ingresarlo por Mesa de Entradas del Centro de Formación Judicial, Bolívar 177, piso 3° de la CABA, en el horario de 11.00 a 16.00 hs. (conf. Disp. N° SECFJ N° 155/15) junto con toda la documentación que establece el Art. 13 del Reglamento de Becas, aprobado por la Res. CACFJ N° 25/11.
</p>
<br>
<p style="font-size:16px">
Atte.<br>
Departamento de Coordinación de Convenios, Becas y Publicaciones.
</p>
<br><br>
<div align="center"><b><i>
Bolivar 177 Piso 3ro - Ciudad Autónoma de Buenos Aires - CP: C1066AAC - Tel: 4008-0284 - Email: cursos@jusbaires.gov.ar
</i></b><div>';
if (!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
return true;
}
}
示例8: tobcc
/**
* @param array $emails_array
* @return $this
*/
public function tobcc(array $emails_array)
{
if (!empty($emails_array)) {
foreach ($emails_array as $m) {
$this->mail->addBCC($m);
}
} else {
$this->mail->addBCC([]);
}
return $this;
}
示例9: get_mail
function get_mail()
{
// we keep the smtp config details in a file
// outside the web root and github for security
include "../tenbreaths_email_config.php";
$mail = new PHPMailer();
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP();
// Set mailer to use SMTP
$mail->Host = $email_config['host'];
// Specify main and backup SMTP servers
$mail->SMTPAuth = true;
// Enable SMTP authentication
$mail->Username = $email_config['username'];
// SMTP username
$mail->Password = $email_config['password'];
// SMTP password
$mail->SMTPSecure = 'tls';
// Enable TLS encryption, `ssl` also accepted
$mail->Port = $email_config['port'];
// TCP port to connect to
if (isset($email_config['bcc']) && $email_config['bcc']) {
$mail->addBCC($email_config['bcc']);
}
return $mail;
}
示例10: populateMessage
/**
* Populate the email message
*/
private function populateMessage()
{
$attributes = $this->attributes;
$this->mailer->CharSet = 'UTF-8';
$this->mailer->Subject = $attributes['subject'];
$from_parts = Email::explodeEmailString($attributes['from']);
$this->mailer->setFrom($from_parts['email'], $from_parts['name']);
$to = Helper::ensureArray($this->attributes['to']);
foreach ($to as $to_addr) {
$to_parts = Email::explodeEmailString($to_addr);
$this->mailer->addAddress($to_parts['email'], $to_parts['name']);
}
if (isset($attributes['cc'])) {
$cc = Helper::ensureArray($attributes['cc']);
foreach ($cc as $cc_addr) {
$cc_parts = Email::explodeEmailString($cc_addr);
$this->mailer->addCC($cc_parts['email'], $cc_parts['name']);
}
}
if (isset($attributes['bcc'])) {
$bcc = Helper::ensureArray($attributes['bcc']);
foreach ($bcc as $bcc_addr) {
$bcc_parts = Email::explodeEmailString($bcc_addr);
$this->mailer->addBCC($bcc_parts['email'], $bcc_parts['name']);
}
}
if (isset($attributes['html'])) {
$this->mailer->msgHTML($attributes['html']);
if (isset($attributes['text'])) {
$this->mailer->AltBody = $attributes['text'];
}
} elseif (isset($attributes['text'])) {
$this->mailer->msgHTML($attributes['text']);
}
}
示例11: send_email
function send_email() {
require_once("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'arshad.cyberlinks@gmail.com'; // SMTP username
$mail->Password = '31513119'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->From = 'arshad.faiyaz@cyberlinks.co.in';
$mail->FromName = 'Arshad Faiyaz';
$mail->addAddress('shekher.cyberlinks@gmail.com', 'Shekher CYberlinks'); // Add a recipient
//$mail->addAddress('anand.vyas@cyberlinks.in', 'Anand Sir'); // Name is optional
$mail->addReplyTo('info@example.com', 'Information'); // Reply To.........
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');
$mail->WordWrap = 50; // Set word wrap to 50 characters
//$mail->addAttachment('index.php'); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'PHP Mailer Testing';
$mail->Body = 'This is the Succefull php Mailer Test <b>By Arshad</b>';
$mail->AltBody = 'Success';
if (!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
}
示例12: testMailing
/**
* @group medium
*/
public function testMailing()
{
#$server = new Server('127.0.0.1', 20025);
#$server->init();
#$server->listen();
#$server->run();
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = '127.0.0.1:20025';
$mail->SMTPAuth = false;
$mail->From = 'from@example.com';
$mail->FromName = 'Mailer';
$mail->addAddress('to1@example.com', 'Joe User');
$mail->addAddress('to2@example.com');
$mail->addReplyTo('reply@example.com', 'Information');
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');
$mail->isHTML(false);
$body = '';
$body .= 'This is the message body.' . Client::MSG_SEPARATOR;
$body .= '.' . Client::MSG_SEPARATOR;
$body .= '..' . Client::MSG_SEPARATOR;
$body .= '.test.' . Client::MSG_SEPARATOR;
$body .= 'END' . Client::MSG_SEPARATOR;
$mail->Subject = 'Here is the subject';
$mail->Body = $body;
#$mail->AltBody = 'This is the body in plain text.';
$this->assertTrue($mail->send());
fwrite(STDOUT, 'mail info: /' . $mail->ErrorInfo . '/' . "\n");
}
示例13: sendEmail
function sendEmail($emailto, $subject, $message)
{
global $db, $systemname, $systememail, $email;
$mail = new PHPMailer();
$mail->isSMTP();
// Set mailer to use SMTP
//$mail->SMTPDebug = 2;
$mail->Host = $email["smtp"];
// Specify main and backup SMTP servers
$mail->Username = $email["user"];
// SMTP username
$mail->Password = $email["pass"];
// SMTP password
$mail->SMTPAuth = true;
// Enable SMTP authentication
$mail->SMTPSecure = "ssl";
// Enable SSL
$mail->Port = 465;
// TCP port to connect to
$mail->CharSet = "UTF-8";
$mail->From = $systememail;
$mail->FromName = $systemname;
$mail->addAddress($emailto);
// Add a recipient
$mail->addBCC($systememail);
// Add a recipient
$mail->Subject = $subject;
$mail->Body = $message;
if (DEBUG === FALSE) {
$mail->send();
} else {
echo $email, ' | ', $subject, ' | ', $message;
}
}
示例14: testConvertEncoding
/**
* Tests CharSet and Unicode -> ASCII conversions for addresses with IDN.
*/
public function testConvertEncoding()
{
if (!$this->Mail->idnSupported()) {
$this->markTestSkipped('intl and/or mbstring extensions are not available');
}
$this->Mail->clearAllRecipients();
$this->Mail->clearReplyTos();
// This file is UTF-8 encoded. Create a domain encoded in "iso-8859-1".
$domain = '@' . mb_convert_encoding('françois.ch', 'ISO-8859-1', 'UTF-8');
$this->Mail->addAddress('test' . $domain);
$this->Mail->addCC('test+cc' . $domain);
$this->Mail->addBCC('test+bcc' . $domain);
$this->Mail->addReplyTo('test+replyto' . $domain);
// Queued addresses are not returned by get*Addresses() before send() call.
$this->assertEmpty($this->Mail->getToAddresses(), 'Bad "to" recipients');
$this->assertEmpty($this->Mail->getCcAddresses(), 'Bad "cc" recipients');
$this->assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients');
$this->assertEmpty($this->Mail->getReplyToAddresses(), 'Bad "reply-to" recipients');
// Clear queued BCC recipient.
$this->Mail->clearBCCs();
$this->buildBody();
$this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
// Addresses with IDN are returned by get*Addresses() after send() call.
$domain = $this->Mail->punyencodeAddress($domain);
$this->assertEquals([['test' . $domain, '']], $this->Mail->getToAddresses(), 'Bad "to" recipients');
$this->assertEquals([['test+cc' . $domain, '']], $this->Mail->getCcAddresses(), 'Bad "cc" recipients');
$this->assertEmpty($this->Mail->getBccAddresses(), 'Bad "bcc" recipients');
$this->assertEquals(['test+replyto' . $domain => ['test+replyto' . $domain, '']], $this->Mail->getReplyToAddresses(), 'Bad "reply-to" addresses');
}
示例15: send
public function send($to, $subject, $message, $from = NULL, $attachments = NULL)
{
if (!$this->enabled) {
return;
}
$isHtml = stripos($message, "<html>") !== FALSE;
$f = $from != NULL ? $from : $this->env->settings()->setting("mail_notification_from");
$validRecipients = $this->getValidRecipients($to);
if (count($validRecipients) === 0) {
Logging::logDebug("No valid recipient email addresses, no mail sent");
return;
}
if (Logging::isDebug()) {
Logging::logDebug("Sending mail from [" . $f . "] to [" . Util::array2str($validRecipients) . "]: [" . $message . "]");
}
set_include_path("vendor/PHPMailer" . DIRECTORY_SEPARATOR . PATH_SEPARATOR . get_include_path());
require 'class.phpmailer.php';
$mailer = new PHPMailer();
$smtp = $this->env->settings()->setting("mail_smtp");
if ($smtp != NULL and isset($smtp["host"])) {
$mailer->isSMTP();
$mailer->Host = $smtp["host"];
if (isset($smtp["username"]) and isset($smtp["password"])) {
$mailer->SMTPAuth = true;
$mailer->Username = $smtp["username"];
$mailer->Password = $smtp["password"];
}
if (isset($smtp["secure"])) {
$mailer->SMTPSecure = $smtp["secure"];
}
}
$mailer->From = $f;
foreach ($validRecipients as $recipient) {
$mailer->addBCC($recipient["email"], $recipient["name"]);
}
if (!$isHtml) {
$mailer->WordWrap = 50;
} else {
$mailer->isHTML(true);
}
if ($attachments != NULL) {
//TODO use stream
foreach ($attachments as $attachment) {
$mailer->addAttachment($attachment);
}
}
$mailer->Subject = $subject;
$mailer->Body = $message;
try {
if (!$mailer->send()) {
Logging::logError('Message could not be sent: ' . $mailer->ErrorInfo);
return FALSE;
}
return TRUE;
} catch (Exception $e) {
Logging::logError('Message could not be sent: ' . $e);
return FALSE;
}
}