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


PHP PHPMailer::ClearBCCs方法代码示例

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


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

示例1: plgAfterSave

 function plgAfterSave(&$model)
 {
     appLogMessage('**** BEGIN Notifications Plugin AfterSave', 'database');
     # Read cms mail config settings
     $configSendmailPath = cmsFramework::getConfig('sendmail');
     $configSmtpAuth = cmsFramework::getConfig('smtpauth');
     $configSmtpUser = cmsFramework::getConfig('smtpuser');
     $configSmtpPass = cmsFramework::getConfig('smtppass');
     $configSmtpHost = cmsFramework::getConfig('smtphost');
     $configSmtpSecure = cmsFramework::getConfig('smtpsecure');
     $configSmtpPort = cmsFramework::getConfig('smtpport');
     $configMailFrom = cmsFramework::getConfig('mailfrom');
     $configFromName = cmsFramework::getConfig('fromname');
     $configMailer = cmsFramework::getConfig('mailer');
     if (!class_exists('PHPMailer')) {
         App::import('Vendor', 'phpmailer' . DS . 'class.phpmailer');
     }
     $mail = new PHPMailer();
     $mail->CharSet = cmsFramework::getCharset();
     $mail->SetLanguage('en', S2_VENDORS . 'PHPMailer' . DS . 'language' . DS);
     $mail->Mailer = $configMailer;
     // Mailer used mail,sendmail,smtp
     switch ($configMailer) {
         case 'smtp':
             $mail->Host = $configSmtpHost;
             $mail->SMTPAuth = $configSmtpAuth;
             $mail->Username = $configSmtpUser;
             $mail->Password = $configSmtpPass;
             $mail->SMTPSecure = $configSmtpSecure != '' ? $configSmtpSecure : '';
             $mail->Port = $configSmtpPort;
             break;
         case 'sendmail':
             $mail->Sendmail = $configSendmailPath;
             break;
         default:
             break;
     }
     $mail->isHTML(true);
     $mail->From = $configMailFrom;
     $mail->FromName = $configFromName;
     # In this observer model we just use the existing data to send the email notification
     switch ($this->notifyModel->name) {
         # Notification for new/edited listings
         case 'Listing':
             if ($this->c->Config->notify_content || $this->c->Config->notify_user_listing) {
                 $this->c->autoRender = false;
                 $listing = $this->_getListing($model);
                 $this->c->set(array('isNew' => isset($model->data['insertid']), 'User' => $this->c->_user, 'listing' => $listing));
             } else {
                 return;
             }
             // Admin listing email
             if ($this->c->Config->notify_content) {
                 $mail->ClearAddresses();
                 $mail->ClearAllRecipients();
                 $mail->ClearBCCs();
                 # Process configuration emails
                 if ($this->c->Config->notify_content_emails == '') {
                     $mail->AddAddress($configMailFrom);
                 } else {
                     $recipient = explode("\n", $this->c->Config->notify_content_emails);
                     foreach ($recipient as $to) {
                         if (trim($to) != '') {
                             $mail->AddAddress(trim($to));
                         }
                     }
                 }
                 $subject = isset($model->data['insertid']) ? __t("New listing", true) . ": {$listing['Listing']['title']}" : __t("Edited listing", true) . ": {$listing['Listing']['title']}";
                 $guest = !$this->c->_user->id ? ' (Guest)' : " ({$this->c->_user->id})";
                 $author = $this->c->_user->id ? $this->c->_user->name : 'Guest';
                 $message = $this->c->render('email_templates', 'admin_listing_notification');
                 $mail->Subject = $subject;
                 $mail->Body = $message;
                 if (!$mail->Send()) {
                     appLogMessage(array("Admin listing message was not sent.", "Mailer error: " . $mail->ErrorInfo), 'notifications');
                 }
             }
             // End admin listing email
             // User listing email - to user submitting the listing as long as he is also the owner of the listing
             if ($this->c->Config->notify_user_listing) {
                 $mail->ClearAddresses();
                 $mail->ClearAllRecipients();
                 $mail->ClearBCCs();
                 //Check if submitter and owner are the same or else email is not sent
                 // This is to prevent the email from going out if admins are doing the editing
                 if ($this->c->_user->id == $listing['User']['user_id']) {
                     // Process configuration emails
                     if ($this->c->Config->notify_user_listing_emails != '') {
                         $recipient = explode("\n", $this->c->Config->notify_user_listing_emails);
                         foreach ($recipient as $bcc) {
                             if (trim($bcc) != '') {
                                 $mail->AddBCC(trim($bcc));
                             }
                         }
                     }
                     $mail->AddAddress(trim($listing['User']['email']));
                     $subject = isset($model->data['insertid']) ? sprintf(__t("New listing: %s", true), $listing['Listing']['title']) : sprintf(__t("Edited listing: %s", true), $listing['Listing']['title']);
                     $guest = !$this->c->_user->id ? ' (Guest)' : " ({$this->c->_user->id})";
                     $author = $this->c->_user->id ? $this->c->_user->name : 'Guest';
                     $message = $this->c->render('email_templates', 'user_listing_notification');
//.........这里部分代码省略.........
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:notifications.php

示例2: wp_mail

function wp_mail($to, $subject, $message, $headers = '') {
	global $phpmailer;

	if ( !is_object( $phpmailer ) ) {
		require_once(ABSPATH . WPINC . '/class-phpmailer.php');
		require_once(ABSPATH . WPINC . '/class-smtp.php');
		$phpmailer = new PHPMailer();
	}

	$mail = compact('to', 'subject', 'message', 'headers');
	$mail = apply_filters('wp_mail', $mail);
	extract($mail);

	if ( $headers == '' ) {
		$headers = "MIME-Version: 1.0\n" .
			"From: " . apply_filters('wp_mail_from', "wordpress@" . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']))) . "\n" . 
			"Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
	}

	$phpmailer->ClearAddresses();
	$phpmailer->ClearCCs();
	$phpmailer->ClearBCCs();
	$phpmailer->ClearReplyTos();
	$phpmailer->ClearAllRecipients();
	$phpmailer->ClearCustomHeaders();

	$phpmailer->FromName = "WordPress";
	$phpmailer->AddAddress("$to", "");
	$phpmailer->Subject = $subject;
	$phpmailer->Body    = $message;
	$phpmailer->IsHTML(false);
	$phpmailer->IsMail(); // set mailer to use php mail()

	do_action_ref_array('phpmailer_init', array(&$phpmailer));

	$mailheaders = (array) explode( "\n", $headers );
	foreach ( $mailheaders as $line ) {
		$header = explode( ":", $line );
		switch ( trim( $header[0] ) ) {
			case "From":
				$from = trim( str_replace( '"', '', $header[1] ) );
				if ( strpos( $from, '<' ) ) {
					$phpmailer->FromName = str_replace( '"', '', substr( $header[1], 0, strpos( $header[1], '<' ) - 1 ) );
					$from = trim( substr( $from, strpos( $from, '<' ) + 1 ) );
					$from = str_replace( '>', '', $from );
				} else {
					$phpmailer->FromName = $from;
				}
				$phpmailer->From = trim( $from );
				break;
			default:
				if ( $line != '' && $header[0] != 'MIME-Version' && $header[0] != 'Content-Type' )
					$phpmailer->AddCustomHeader( $line );
				break;
		}
	}

	$result = @$phpmailer->Send();

	return $result;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:61,代码来源:pluggable.php

示例3: COM_emailNotification

function COM_emailNotification($msgData = array())
{
    global $_CONF;
    // define the maximum number of emails allowed per bcc
    $maxEmailsPerSend = 10;
    // ensure we have something to send...
    if (!isset($msgData['htmlmessage']) && !isset($msgData['textmessage'])) {
        COM_errorLog("COM_emailNotification() - No message data provided");
        return false;
        // no message defined
    }
    if (empty($msgData['htmlmessage']) && empty($msgData['textmessage'])) {
        COM_errorLog("COM_emailNotification() - Empty message data provided");
        return false;
        // no text in either...
    }
    if (!isset($msgData['subject']) || empty($msgData['subject'])) {
        COM_errorLog("COM_emailNotification() - No subject provided");
        return false;
        // must have a subject
    }
    $queued = 0;
    $subject = substr($msgData['subject'], 0, strcspn($msgData['subject'], "\r\n"));
    $subject = COM_emailEscape($subject);
    require_once $_CONF['path'] . 'lib/phpmailer/class.phpmailer.php';
    $mail = new PHPMailer();
    $mail->SetLanguage('en', $_CONF['path'] . 'lib/phpmailer/language/');
    $mail->CharSet = COM_getCharset();
    if ($_CONF['mail_backend'] == 'smtp') {
        $mail->IsSMTP();
        $mail->Host = $_CONF['mail_smtp_host'];
        $mail->Port = $_CONF['mail_smtp_port'];
        if ($_CONF['mail_smtp_secure'] != 'none') {
            $mail->SMTPSecure = $_CONF['mail_smtp_secure'];
        }
        if ($_CONF['mail_smtp_auth']) {
            $mail->SMTPAuth = true;
            $mail->Username = $_CONF['mail_smtp_username'];
            $mail->Password = $_CONF['mail_smtp_password'];
        }
        $mail->Mailer = "smtp";
    } elseif ($_CONF['mail_backend'] == 'sendmail') {
        $mail->Mailer = "sendmail";
        $mail->Sendmail = $_CONF['mail_sendmail_path'];
    } else {
        $mail->Mailer = "mail";
    }
    $mail->WordWrap = 76;
    if (isset($msgData['htmlmessage']) && !empty($msgData['htmlmessage'])) {
        $mail->IsHTML(true);
        $mail->Body = $msgData['htmlmessage'];
        if (isset($msgData['textmessage']) && !empty($msgData['textmessage'])) {
            $mail->AltBody = $msgData['textmessage'];
        }
    } else {
        $mail->IsHTML(false);
        if (isset($msgData['textmessage']) && !empty($msgData['textmessage'])) {
            $mail->Body = $msgData['textmessage'];
        }
    }
    $mail->Subject = $subject;
    if (isset($msgData['embeddedImage']) && is_array($msgData['embeddedImage'])) {
        foreach ($msgData['embeddedImage'] as $embeddedImage) {
            $mail->AddEmbeddedImage($embeddedImage['file'], $embeddedImage['name'], $embeddedImage['filename'], $embeddedImage['encoding'], $embeddedImage['mime']);
        }
    }
    if (is_array($msgData['from'])) {
        $mail->From = $msgData['from']['email'];
        $mail->FromName = $msgData['from']['name'];
    } else {
        $mail->From = $msgData['from'];
        $mail->FromName = $_CONF['site_name'];
    }
    $queued = 0;
    if (is_array($msgData['to'])) {
        foreach ($msgData['to'] as $to) {
            if (is_array($to)) {
                $mail->AddBCC($to['email'], $to['name']);
            } else {
                if (COM_isEmail($to)) {
                    $mail->AddBCC($to);
                }
            }
            $queued++;
            if ($queued >= $maxEmailsPerSend) {
                if (!$mail->Send()) {
                    COM_errorLog("Email Error: " . $mail->ErrorInfo);
                }
                $queued = 0;
                $mail->ClearBCCs();
            }
        }
    }
    if ($queued > 0) {
        if (!@$mail->Send()) {
            COM_errorLog("Email Error: " . $mail->ErrorInfo);
        }
    }
}
开发者ID:NewRoute,项目名称:glfusion,代码行数:99,代码来源:lib-common.php

示例4: osc_sendMail

function osc_sendMail($params)
{
    // DO NOT send mail if it's a demo
    if (defined('DEMO')) {
        return false;
    }
    $mail = new PHPMailer(true);
    $mail->ClearAddresses();
    $mail->ClearAllRecipients();
    $mail->ClearAttachments();
    $mail->ClearBCCs();
    $mail->ClearCCs();
    $mail->ClearCustomHeaders();
    $mail->ClearReplyTos();
    $mail = osc_apply_filter('init_send_mail', $mail, $params);
    if (osc_mailserver_pop()) {
        require_once osc_lib_path() . 'phpmailer/class.pop3.php';
        $pop = new POP3();
        $pop3_host = osc_mailserver_host();
        if (array_key_exists('host', $params)) {
            $pop3_host = $params['host'];
        }
        $pop3_port = osc_mailserver_port();
        if (array_key_exists('port', $params)) {
            $pop3_port = $params['port'];
        }
        $pop3_username = osc_mailserver_username();
        if (array_key_exists('username', $params)) {
            $pop3_username = $params['username'];
        }
        $pop3_password = osc_mailserver_password();
        if (array_key_exists('password', $params)) {
            $pop3_password = $params['password'];
        }
        $pop->Authorise($pop3_host, $pop3_port, 30, $pop3_username, $pop3_password, 0);
    }
    if (osc_mailserver_auth()) {
        $mail->IsSMTP();
        $mail->SMTPAuth = true;
    } else {
        if (osc_mailserver_pop()) {
            $mail->IsSMTP();
        }
    }
    $smtpSecure = osc_mailserver_ssl();
    if (array_key_exists('password', $params)) {
        $smtpSecure = $params['ssl'];
    }
    if ($smtpSecure != '') {
        $mail->SMTPSecure = $smtpSecure;
    }
    $stmpUsername = osc_mailserver_username();
    if (array_key_exists('username', $params)) {
        $stmpUsername = $params['username'];
    }
    if ($stmpUsername != '') {
        $mail->Username = $stmpUsername;
    }
    $smtpPassword = osc_mailserver_password();
    if (array_key_exists('password', $params)) {
        $smtpPassword = $params['password'];
    }
    if ($smtpPassword != '') {
        $mail->Password = $smtpPassword;
    }
    $smtpHost = osc_mailserver_host();
    if (array_key_exists('host', $params)) {
        $smtpHost = $params['host'];
    }
    if ($smtpHost != '') {
        $mail->Host = $smtpHost;
    }
    $smtpPort = osc_mailserver_port();
    if (array_key_exists('port', $params)) {
        $smtpPort = $params['port'];
    }
    if ($smtpPort != '') {
        $mail->Port = $smtpPort;
    }
    $from = osc_mailserver_mail_from();
    if (empty($from)) {
        $from = 'osclass@' . osc_get_domain();
        if (array_key_exists('from', $params)) {
            $from = $params['from'];
        }
    }
    $from_name = osc_mailserver_name_from();
    if (empty($from_name)) {
        $from_name = osc_page_title();
        if (array_key_exists('from_name', $params)) {
            $from_name = $params['from_name'];
        }
    }
    $mail->From = osc_apply_filter('mail_from', $from, $params);
    $mail->FromName = osc_apply_filter('mail_from_name', $from_name, $params);
    $to = $params['to'];
    $to_name = '';
    if (array_key_exists('to_name', $params)) {
        $to_name = $params['to_name'];
    }
//.........这里部分代码省略.........
开发者ID:naneri,项目名称:Osclass,代码行数:101,代码来源:utils.php

示例5: send_email_campaign

 public function send_email_campaign($sender_data, $receiver_data, $template_data, $user_config)
 {
     $this->load->library('My_PHPMailer');
     $setup = array("smtp_host" => $user_config['smtp_host'], "smtp_port" => $user_config['smtp_port'], "smtp_protocol" => "TLS", "smtp_auth" => true, "smtp_username" => $user_config['smtp_username'], "smtp_password" => $user_config['smtp_password']);
     $mail = new PHPMailer();
     $mail->XMailer = 'PHP ';
     $mail->CharSet = 'UTF-8';
     //$mail->SMTPDebug = 3; // Enable verbose debug output
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = $setup['smtp_host'];
     // Specify main and backup SMTP servers  'smtp1.example.com;smtp2.example.com'
     $mail->SMTPAuth = $setup['smtp_auth'] ? true : false;
     // Enable SMTP authentication
     $mail->Username = $setup['smtp_username'];
     // SMTP username
     $mail->Password = $setup['smtp_password'];
     // SMTP password
     $mail->SMTPSecure = $setup['smtp_protocol'];
     // Enable TLS encryption, `ssl` also accepted
     $mail->Port = $setup['smtp_port'];
     // TCP port to connect to
     $mail->ClearAllRecipients();
     $mail->ClearAddresses();
     $mail->ClearCCs();
     $mail->ClearBCCs();
     $mail->ClearReplyTos();
     $mail->ClearAttachments();
     $mail->ClearCustomHeaders();
     $mail->From = $sender_data['email'];
     $mail->FromName = $sender_data['name'];
     $mail->addAddress($receiver_data['email'], $receiver_data['name']);
     // Add a recipient
     $mail->addReplyTo($sender_data['email'], '');
     $mail->isHTML(true);
     // Set email format to HTML
     $body = $this->load->view('email/campaign_email', array('template_data' => $template_data), true);
     $mail->Subject = $template_data['subject'];
     $mail->Body = $body;
     // html mail
     $mail->AltBody = $body;
     // Plain text mail
     // For most clients expecting the Priority header:
     // 1 = High, 2 = Medium, 3 = Low
     $mail->Priority = 1;
     // MS Outlook custom header
     // May set to "Urgent" or "Highest" rather than "High"
     $mail->AddCustomHeader("X-MSMail-Priority: High");
     // Not sure if Priority will also set the Importance header:
     $mail->AddCustomHeader("Importance: High");
     $mail->AddCustomHeader("X-Sender: <{''}>\n");
     $mail->addCustomHeader("List-Unsubscribe", "<mailto:unsubscribe@digibuzz24.net/unsubscribe.php?email='" . $sender_data['email'] . "'>");
     $mail->addCustomHeader("List-Subscribe", "<mailto:subscribe@digibuzz24.net/subscribe.php?email='" . $sender_data['email'] . "'>");
     $mail->addCustomHeader("List-Owner", "<mailto:admin@digibuzz24.net>");
     // Uncomment this
     if ($mail->send()) {
         return 'ok';
     } else {
         //echo 'Mailer Error: ' . $mail->ErrorInfo; exit;
         return 'error';
     }
 }
开发者ID:ArpanTanna,项目名称:seo,代码行数:62,代码来源:MY_Controller.php

示例6: webmaster_email

function webmaster_email($mittente, $oggetto, $corpo)
{
    $destinatario = "apocalisse_@apocanow.it";
    $email_to = new PHPMailer();
    $email_to->From = $mittente;
    $email_to->FromName = $mittente;
    $email_to->Subject = $oggetto;
    $email_to->Body = $corpo;
    $email_to->Sender = $mittente;
    $email_to->isSMTP();
    $email_to->SMTPAuth = true;
    $email_to->Host = "";
    $email_to->Username = "";
    $email_to->Password = "";
    $email_to->Mailer = "smtp";
    $email_to->replyTo = "";
    $email_to->AddAddress($destinatario);
    $email_to->Send();
    $email_to->ClearAddresses();
    $email_to->ClearBCCs();
    $email_to->ClearAttachments();
}
开发者ID:panktidesai,项目名称:ICSE-2012-EVOSS,代码行数:22,代码来源:php_common.php

示例7: send

 /**
  * Send mail for a particular $comment
  * Inspired by code from the core for wp_mail function.
  * 
  * @global PHPMailer $phpmailer
  * @param object $comment result of get_comment
  * @return boolean TRUE if all messages sent okay, FALSE if any individual send gives error.
  */
 public function send($comment)
 {
     global $phpmailer;
     // get PHPMailer and SMTP classes, if not already available.
     if (!is_object($phpmailer) || !is_a($phpmailer, "PHPMailer")) {
         require_once ABSPATH . WPINC . "/class-phpmailer.php";
         require_once ABSPATH . WPINC . "/class-smtp.php";
         $phpmailer = new PHPMailer(TRUE);
     }
     $num_messages = $this->numMessages();
     // send each message that has been loaded into this object:
     for ($mid = 0; $mid < $num_messages; $mid++) {
         $this->selectMessage($mid);
         $recipient_email = $comment->comment_author_email;
         $from_name = $this->getParsedFromName($comment);
         $from_email = $this->getParsedFromEmail($comment);
         $recipient_name = $comment->comment_author;
         $body_html = $this->getParsedHtmlMessage($comment);
         $body_plain = $this->getParsedPlainMessage($comment);
         // clear any previous PHPMailer settings
         $phpmailer->ClearAddresses();
         $phpmailer->ClearAllRecipients();
         $phpmailer->ClearAttachments();
         $phpmailer->ClearBCCs();
         $phpmailer->ClearCCs();
         $phpmailer->ClearCustomHeaders();
         $phpmailer->ClearReplyTos();
         // set from and subject
         $phpmailer->From = $from_email;
         $phpmailer->FromName = $from_name;
         $phpmailer->Subject = $this->getParsedSubject($comment);
         // set recipient
         try {
             if (version_compare(PHP_VERSION, "5.2.11", ">=") && version_compare(PHP_VERSION, "5.3", "<") || version_compare(PHP_VERSION, "5.3.1", ">=")) {
                 $phpmailer->AddAddress($recipient_email, $recipient_name);
             } else {
                 // Support: PHP <5.2.11 and PHP 3.0. mail() function on
                 // Windows has bug; doesn't deal with recipient name
                 // correctly. See https://bugs.php.net/bug.php?id=28038
                 $phpmailer->AddAddress(trim($recipient_email));
             }
         } catch (phpmailerException $e) {
             return FALSE;
         }
         // body HTML needs to be cut off at reasonable line length
         $body_html_wrapped = wordwrap($body_html, 900, "\n", TRUE);
         // add HTML body and alternative plain text.
         $phpmailer->Body = $body_html_wrapped;
         $phpmailer->isHTML(true);
         $phpmailer->AltBody = $body_plain;
         $phpmailer->Encoding = "8bit";
         $phpmailer->WordWrap = 80;
         // word wrap the plain text message
         $phpmailer->CharSet = "UTF-8";
         // try to send
         try {
             $phpmailer->Send();
         } catch (phpmailerException $e) {
             var_dump($e);
             return FALSE;
         }
         try {
         } catch (Exception $ex) {
         }
     }
     return TRUE;
 }
开发者ID:NYC2015,项目名称:team-12,代码行数:75,代码来源:Message.php

示例8: mailto

 /**
  * 发送邮件
  * @param $pAddress 地址
  * @param $pSubject 标题
  * @param $pBody 内容
  */
 static function mailto($pAddress, $pSubject, $pBody)
 {
     static $mail;
     if (!$mail) {
         require preg_replace('/Tool/', '', dirname(__FILE__)) . 'Source/PHPMailer/PHPmailer.php';
         $tMailconfig = Yaf_Registry::get("config")->mail->default->toArray();
         $mail = new PHPMailer();
         $mail->IsSMTP();
         $mail->CharSet = 'utf-8';
         $mail->SMTPAuth = true;
         $mail->Port = 25;
         $mail->Host = $tMailconfig['host'];
         $mail->From = $tMailconfig['from'];
         $mail->Username = $tMailconfig['username'];
         $mail->Password = $tMailconfig['password'];
         $mail->FromName = "拍医拍";
         $mail->IsHTML(true);
     }
     $mail->ClearAddresses();
     $mail->ClearCCs();
     $mail->ClearBCCs();
     $mail->AddAddress($pAddress);
     #$pCcAddress && $mail->AddBCC($pCcAddress);
     $mail->Subject = $pSubject;
     $mail->MsgHTML(preg_replace('/\\\\/', '', $pBody));
     if ($mail->Send()) {
         return 1;
     } else {
         return $mail->ErrorInfo;
     }
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:37,代码来源:Fnc.php

示例9: send_mail


//.........这里部分代码省略.........
    }
    if ($delais_option_reservation > 0 && $option_reservation != -1) {
        $reservation = $reservation . '*** ' . $vocab['reservation_a_confirmer_au_plus_tard_le'] . ' ' . time_date_string_jma($option_reservation, $dformat) . " ***\n";
    }
    $reservation = $reservation . "-----\n";
    $message = $message . $reservation;
    $message = $message . $vocab['msg_no_email'] . Settings::get('webmaster_email');
    $message = html_entity_decode($message);
    $sql = 'SELECT u.email FROM ' . TABLE_PREFIX . '_utilisateurs u, ' . TABLE_PREFIX . "_j_mailuser_room j WHERE (j.id_room='" . protect_data_sql($room_id) . "' AND u.login=j.login and u.etat='actif') ORDER BY u.nom, u.prenom";
    $res = grr_sql_query($sql);
    $nombre = grr_sql_count($res);
    if ($nombre > 0) {
        $tab_destinataire = array();
        for ($i = 0; $row = grr_sql_row($res, $i); ++$i) {
            if ($row[0] != '') {
                $tab_destinataire[] = $row[0];
            }
        }
        foreach ($tab_destinataire as $value) {
            if (Settings::get('grr_mail_Bcc') == 'y') {
                $mail->AddBCC($value);
            } else {
                $mail->AddAddress($value);
            }
        }
        $mail->Subject = $sujet;
        $mail->Body = $message;
        $mail->AddReplyTo($repondre);
        if (!$mail->Send()) {
            $message_erreur .= $mail->ErrorInfo;
        }
    }
    $mail->ClearAddresses();
    $mail->ClearBCCs();
    $mail->ClearReplyTos();
    if ($action == 7) {
        $mail_admin = find_user_room($room_id);
        if (count($mail_admin) > 0) {
            foreach ($mail_admin as $value) {
                if (Settings::get('grr_mail_Bcc') == 'y') {
                    $mail->AddBCC($value);
                } else {
                    $mail->AddAddress($value);
                }
            }
            $mail->Subject = $sujet;
            $mail->Body = $message;
            $mail->AddReplyTo($repondre);
            if (!$mail->Send()) {
                $message_erreur .= $mail->ErrorInfo;
            }
        }
        $mail->ClearAddresses();
        $mail->ClearBCCs();
        $mail->ClearReplyTos();
    }
    if ($action == 7) {
        $sujet7 = $vocab['subject_mail1'] . $room_name . ' - ' . $date_avis;
        $sujet7 .= $vocab['subject_mail_retard'];
        $message7 = removeMailUnicode(Settings::get('company')) . ' - ' . $vocab['title_mail'];
        $message7 .= traite_grr_url('', 'y') . "\n\n";
        $message7 .= $vocab['ressource empruntee non restituée'] . "\n";
        $message7 .= $room_name . ' (' . $area_name . ')';
        $message7 .= "\n" . $reservation;
        $message7 = html_entity_decode($message7);
        $destinataire7 = $beneficiaire_email;
开发者ID:nicolas-san,项目名称:GRR,代码行数:67,代码来源:functions.inc.php

示例10:

    $mail->Body = $message;
    $to_email_id = "meetmurali@gmail.com";
    $mail->AddAddress($to_email_id, "WeMakeScholars");
    //$mail->IsSMTP();
    $mail->Mailer = "mail";
    $mail->Host = "166.62.28.80";
    $mail->Port = 25;
    if (!$mail->Send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
        exit;
    }
    $mail->ClearAddresses();
    $mail->ClearAllRecipients();
    $mail->ClearAttachments();
    $mail->ClearBCCs();
    $mail->ClearCCs();
    $mail->ClearCustomHeaders();
    $query1 = "UPDATE registration set weeklynewsletteremailstatus=1 where email_id=? ";
    if (!($stmt1 = $mysqli->prepare($query1))) {
        echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
        exit;
    }
    $stmt1->bind_param("s", $email_id);
    if (!$stmt1->execute()) {
        echo "Execute failed: (" . $stmt1->errno . ") " . $stmt1->error;
        exit;
    }
    $stmt1->close();
}
$stmt->close();
开发者ID:EarthBug,项目名称:irksome-barnacle,代码行数:31,代码来源:newsletter_working.php

示例11: SendEmail


//.........这里部分代码省略.........
            $mail->Port = 25;
        }
        $mail->Host = $sSMTPHost;
        // SMTP server name
    } else {
        $mail->IsSendmail();
        // tell the class to use Sendmail
    }
    $bContinue = TRUE;
    $sLoopTimeout = 30;
    // Break out of loop if this time is exceeded
    $iMaxAttempts = 3;
    // Error out if an email address fails 3 times
    while ($bContinue) {
        // Three ways to get out of this loop
        // 1.  We're finished sending email
        // 2.  Time exceeds $sLoopTimeout
        // 3.  Something strange happens
        //        (maybe user tries to send from multiple sessions
        //         causing counts and timestamps to 'misbehave' )
        $tTimeStamp = date('Y-m-d H:i:s');
        $mail->Subject = $sSubject;
        $mail->Body = $sMessage;
        if ($sRecipient == 'get_recipients_from_mysql') {
            $rsEmailAddress = RunQuery($sSQLGetEmail);
            // This query has limit one to pick up one recipient
            $aRow = mysql_fetch_array($rsEmailAddress);
            extract($aRow);
            $mail->AddAddress($erp_email_address);
        } else {
            $erp_email_address = $sRecipient;
            $mail->AddAddress($erp_email_address);
            $bContinue = FALSE;
            // Just sending one email
        }
        if (!$mail->Send()) {
            // failed- make a note in the log and the recipient record
            if ($sRecipient == 'get_recipients_from_mysql') {
                $sMsg = "Failed sending to: {$erp_email_address} ";
                $sMsg .= $mail->ErrorInfo;
                echo "{$sMsg}<br>\n";
                AddToEmailLog($sMsg, $iUserID);
                // Increment the number of attempts for this message
                $erp_num_attempt++;
                $sSQL = 'UPDATE email_recipient_pending_erp ' . "SET erp_num_attempt='{$erp_num_attempt}' ," . "    erp_failed_time='{$tTimeStamp}' " . "WHERE erp_id='{$erp_id}'";
                RunQuery($sSQL);
                // Check if we've maxed out retry attempts
                if ($erp_num_attempt < $iMaxAttempts) {
                    echo "Pausing 15 seconds after failure<br>\n";
                    AddToEmailLog('Pausing 15 seconds after failure', $iUserID);
                    sleep(15);
                    // Delay 15 seconds on failure
                    // The mail server may be having a temporary problem
                } else {
                    $_SESSION['sEmailState'] = 'error';
                    $bContinue = FALSE;
                    $sMsg = 'Too many failures. Giving up. You may try to resume later.';
                    AddToEmailLog($sMsg, $iUserID);
                }
            } else {
                $sMsg = "Failed sending to: {$sRecipient} ";
                $sMsg .= $mail->ErrorInfo;
                echo "{$sMsg}<br>\n";
                AddToEmailLog($sMsg, $iUserID);
            }
        } else {
            if ($sRecipient == 'get_recipients_from_mysql') {
                echo "<b>{$erp_email_address}</b> Sent! <br>\n";
                $sMsg = "Email sent to: {$erp_email_address}";
                AddToEmailLog($sMsg, $iUserID);
                // Delete this record from the recipient list
                $sSQL = 'DELETE FROM email_recipient_pending_erp ' . "WHERE erp_email_address='{$erp_email_address}'";
                RunQuery($sSQL);
            } else {
                echo "<b>{$sRecipient}</b> Sent! <br>\n";
                $sMsg = "Email sent to: {$erp_email_address}";
                AddToEmailLog($sMsg, $iUserID);
            }
        }
        $mail->ClearAddresses();
        $mail->ClearBCCs();
        // Are we done?
        extract(mysql_fetch_array(RunQuery($sSQL_ERP)));
        // this query counts remaining recipient records
        if ($sRecipient == 'get_recipients_from_mysql' && $countrecipients == 0) {
            $bContinue = FALSE;
            $_SESSION['sEmailState'] = 'finish';
            AddToEmailLog('Job Finished', $iUserID);
        }
        if (time() - $tStartTime > $sLoopTimeout) {
            // bail out of this loop if we've taken more than $sLoopTimeout seconds.
            // The meta refresh will reload this page so we can pick up where
            // we left off
            $bContinue = FALSE;
        }
    }
    if (strtolower($sSendType) == 'smtp') {
        $mail->SmtpClose();
    }
}
开发者ID:dschwen,项目名称:CRM,代码行数:101,代码来源:EmailSend.php

示例12: sendMail

 public static function sendMail($email_to, $subject, $body)
 {
     Param::checkRequired(array(self::PARAM_FROM_EMAIL, self::PARAM_FROM_NAME, self::PARAM_REPLY_EMAIL, self::PARAM_HOST, self::PARAM_PORT, self::PARAM_LOGIN, self::PARAM_PASSWORD));
     require_once LIBRARIES_PATH . 'PHPMailer/class.phpmailer.php';
     $settings = Param::model()->findCodesValues('mailer');
     $encoding = "utf-8";
     $hidden_copy = true;
     $subject = iconv($encoding, "{$encoding}//IGNORE", $subject);
     $from_name = iconv($encoding, "{$encoding}//IGNORE", $settings[self::PARAM_FROM_NAME]);
     $from_email = iconv($encoding, "{$encoding}//IGNORE", $settings[self::PARAM_FROM_EMAIL]);
     $reply_email = iconv($encoding, "{$encoding}//IGNORE", $settings[self::PARAM_REPLY_EMAIL]);
     $mail = new PHPMailer(true);
     $mail->IsSMTP();
     $mail->CharSet = $encoding;
     $mail->SMTPDebug = 1;
     $mail->Host = $settings[self::PARAM_HOST];
     $mail->SMTPAuth = true;
     $mail->SMTPKeepAlive = true;
     $mail->Port = $settings[self::PARAM_PORT];
     $mail->Username = $settings[self::PARAM_LOGIN];
     $mail->Password = $settings[self::PARAM_PASSWORD];
     $mail->AddReplyTo($reply_email, $from_name);
     $add_address_method = $hidden_copy ? 'AddBCC' : 'AddAddress';
     if (is_array($email_to)) {
         foreach ($email_to as $ind => $email) {
             $mail->{$add_address_method}($email, $email);
         }
     } else {
         $mail->{$add_address_method}($email_to, $email_to);
     }
     $mail->SetFrom($from_email, $from_name);
     $mail->Subject = $subject;
     $mail->MsgHTML(iconv($encoding, "{$encoding}//IGNORE", $body));
     $mail->Send();
     $mail->ClearAttachments();
     $mail->ClearBCCs();
     $mail->ClearAddresses();
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:38,代码来源:MailerOutbox.php

示例13: explode

                case 'bcc':
                    $bcc = array_merge((array) $bcc, explode(',', $content));
                    break;
                default:
                    // Add it to our grand headers array
                    $headers[trim($name)] = trim($content);
                    break;
            }
        }
    }
}
// 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 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']);
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:31,代码来源:function.wp_mail.php

示例14: PHPMailer

 static function old_send_email($to, $subject, $html, $text, $istest = false, $sid, $list_id, $report_id)
 {
     global $phpmailer, $wpdb;
     // (Re)create it, if it's gone missing
     if (!is_object($phpmailer) || !is_a($phpmailer, 'PHPMailer')) {
         require_once ABSPATH . WPINC . '/class-phpmailer.php';
         require_once ABSPATH . WPINC . '/class-smtp.php';
         $phpmailer = new PHPMailer();
     }
     /*
      * Make sure the mailer thingy is clean before we start,  should not
      * be necessary, but who knows what others are doing to our mailer
      */
     $phpmailer->ClearAddresses();
     $phpmailer->ClearAllRecipients();
     $phpmailer->ClearAttachments();
     $phpmailer->ClearBCCs();
     $phpmailer->ClearCCs();
     $phpmailer->ClearCustomHeaders();
     $phpmailer->ClearReplyTos();
     //return $email;
     //
     $charset = SendPress_Option::get('email-charset', 'UTF-8');
     $encoding = SendPress_Option::get('email-encoding', '8bit');
     $phpmailer->CharSet = $charset;
     $phpmailer->Encoding = $encoding;
     if ($charset != 'UTF-8') {
         $sender = new SendPress_Sender();
         $html = $sender->change($html, 'UTF-8', $charset);
         $text = $sender->change($text, 'UTF-8', $charset);
         $subject = $sender->change($subject, 'UTF-8', $charset);
     }
     $subject = str_replace(array('’', '“', '�', '–'), array("'", '"', '"', '-'), $subject);
     $html = str_replace(chr(194), chr(32), $html);
     $text = str_replace(chr(194), chr(32), $text);
     $phpmailer->AddAddress(trim($to));
     $phpmailer->AltBody = $text;
     $phpmailer->Subject = $subject;
     $phpmailer->MsgHTML($html);
     $content_type = 'text/html';
     $phpmailer->ContentType = $content_type;
     // Set whether it's plaintext, depending on $content_type
     //if ( 'text/html' == $content_type )
     $phpmailer->IsHTML(true);
     /**
      * We'll let php init mess with the message body and headers.  But then
      * we stomp all over it.  Sorry, my plug-inis more important than yours :)
      */
     do_action_ref_array('phpmailer_init', array(&$phpmailer));
     $from_email = SendPress_Option::get('fromemail');
     $phpmailer->From = $from_email;
     $phpmailer->FromName = SendPress_Option::get('fromname');
     $phpmailer->Sender = SendPress_Option::get('fromemail');
     $sending_method = SendPress_Option::get('sendmethod');
     $phpmailer = apply_filters('sendpress_sending_method_' . $sending_method, $phpmailer);
     $hdr = new SendPress_SendGrid_SMTP_API();
     $hdr->addFilterSetting('dkim', 'domain', SendPress_Manager::get_domain_from_email($from_email));
     $phpmailer->AddCustomHeader(sprintf('X-SMTPAPI: %s', $hdr->asJSON()));
     $phpmailer->AddCustomHeader('X-SP-METHOD: old');
     // Set SMTPDebug to 2 will collect dialogue between us and the mail server
     if ($istest == true) {
         $phpmailer->SMTPDebug = 2;
         // Start output buffering to grab smtp output
         ob_start();
     }
     // Send!
     $result = true;
     // start with true, meaning no error
     $result = @$phpmailer->Send();
     //$phpmailer->SMTPClose();
     if ($istest == true) {
         // Grab the smtp debugging output
         $smtp_debug = ob_get_clean();
         SendPress_Option::set('phpmailer_error', $phpmailer->ErrorInfo);
         SendPress_Option::set('last_test_debug', $smtp_debug);
     }
     if ($result != true && $istest == true) {
         $hostmsg = 'host: ' . $phpmailer->Host . '  port: ' . $phpmailer->Port . '  secure: ' . $phpmailer->SMTPSecure . '  auth: ' . $phpmailer->SMTPAuth . '  user: ' . $phpmailer->Username . "  pass: *******\n";
         $msg = '';
         $msg .= __('The result was: ', 'sendpress') . $result . "\n";
         $msg .= __('The mailer error info: ', 'sendpress') . $phpmailer->ErrorInfo . "\n";
         $msg .= $hostmsg;
         $msg .= __("The SMTP debugging output is shown below:\n", "sendpress");
         $msg .= $smtp_debug . "\n";
     }
     return $result;
 }
开发者ID:pedro-mendonca,项目名称:sendpress,代码行数:87,代码来源:class-sendpress-manager.php

示例15: extract


//.........这里部分代码省略.........
                         // So... making my life hard again?
                         $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)) {
开发者ID:nurpax,项目名称:saastafi,代码行数:67,代码来源:pluggable.php


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