本文整理汇总了PHP中PHPMailer::ClearAddresses方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::ClearAddresses方法的具体用法?PHP PHPMailer::ClearAddresses怎么用?PHP PHPMailer::ClearAddresses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::ClearAddresses方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendNewsletter
function sendNewsletter($queueID = 0)
{
if ($queueID == 0) {
return false;
}
//wtf? not queueID was defined musta been a booboo!
//k we need to umm grab the info from the queue
$queueResults = dbQuery('SELECT e.*, t.* FROM email_queue AS e, email_templates AS t WHERE t.email_templates_id = e.email_template_id AND e.email_queue_id = ' . $queueID);
$q = dbFetchArray($queueResults);
//we have everything we need i believe!
//lets send out the newsletter, then remove it from the queue and add to the sent table
//the sent table will allow the admin to resend at anytime
//include the class phpmailer()
include_once 'classes/class.phpmailer.php';
//now we need to get stuff!
$content = output($q['email_templates_header']);
$content .= output($q['email_queue_email_text']);
$content .= output($q['email_templates_footer']);
$q['content'] = $content;
$recipients = explode(',', $q['email_queue_recipients']);
foreach ($recipients as $key => $val) {
$mail = new PHPMailer();
$mail->From = output($q['email_queue_from']);
$mail->FromName = output($q['email_queue_from']);
$mail->isMail = true;
$mail->Body = output($content);
$mail->AddAddress($val);
$mail->Subject = output($q['email_queue_subject']);
//check to see if there is an attachment
if ($q['email_queue_attachment'] != "") {
$mail->AddAttachment(UPLOAD_DIR_NEWSLETTER . $q['email_queue_attachment'], $q['email_queue_attachment']);
}
$mail->ContentType = 'text/html';
$mail->Send();
$mail->ClearAddresses();
}
$row['client_id'] = 1;
$row['email_queue_date_sent'] = time();
$row['email_queue_subject'] = $q['email_queue_subject'];
$row['email_queue_content'] = $q['content'];
$row['email_templates_id'] = $q['email_template_id'];
$row['email_recipients'] = $q['email_queue_recipients'];
$row['email_display_home'] = $q['email_display_home'];
dbPerform('email_queue_sent', $row, 'insert');
dbQuery('DELETE FROM email_queue WHERE email_queue_id = ' . $q['email_queue_id']);
return true;
}
示例2: handle
public function handle($fromTitle, $fromMail, $toEmail, $subject, $body, $attachments, $smtpHost, $smtpPort, $serverLogin = '', $serverPassword = '', $charCode = 'UTF-8', $isHtml = false)
{
if (!is_object($this->_mail)) {
$this->_mail = new PHPMailer();
}
$this->_mail->CharSet = $charCode;
$this->_mail->IsHTML($isHtml);
$this->_mail->From = $fromMail;
$this->_mail->FromName = $fromTitle;
$this->_mail->AddReplyTo($fromMail, $fromTitle);
$this->_mail->Subject = $subject;
$this->_mail->Body = $body;
$this->_mail->AltBody = '';
$this->_mail->AddAddress($toEmail, '');
$this->_mail->IsSMTP(true);
$this->_mail->Mailer = 'smtp';
$this->_mail->Host = $smtpHost;
$this->_mail->Port = $smtpPort;
if ($serverLogin != '') {
$this->_mail->SMTPAuth = true;
$this->_mail->Username = $serverLogin;
$this->_mail->Password = $serverPassword;
} else {
$this->_mail->SMTPAuth = false;
$this->_mail->Username = '';
$this->_mail->Password = '';
}
if (is_object($attachments)) {
//FIXME
// // zalaczniki
//for ($z = 0; $z < Count($tab_mail_oma_zalacznik[$tab_mail_id[$i]]); $z++) {
//if (($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z] != '') AND (file_exists($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]))) {
//if ($tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] == '') {
//$this->_mail->AddAttachment($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], basename($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]));
//} // koniec if...
//else {
//$this->_mail->AddEmbeddedImage($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z]);
//$tmp_tresc = str_replace('[' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] . ']', 'cid:' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z], $tmp_tresc);
//} // koniec else...
//} // koniec if...
//} // koniec for...
}
if (!$this->_mail->Send()) {
$status = false;
} else {
$status = true;
}
$this->_mail->ClearAddresses();
$this->_mail->ClearAttachments();
return $status;
}
示例3: smtpmail
function smtpmail($to, $subject, $content)
{
require_once "config_app.php";
require '../lib/phpmailer/class.phpmailer.php';
require '../lib/phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->SMTPDebug = $__smtp['debug'];
$mail->isSMTP();
$mail->Host = $__smtp['host'];
$mail->SMTPAuth = $__smtp['auth'];
$mail->Username = $__smtp['username'];
$mail->Password = $__smtp['password'];
$mail->SMTPSecure = 'tls';
$mail->Port = $__smtp['port'];
$mail->SetFrom($__smtp['addreply'], 'Mashkov Andrey');
$mail->AddReplyTo($__smtp['addreply'], $__smtp['username']);
$mail->AddAddress($to);
$mail->isHTML(true);
$mail->CharSet = 'utf8';
//кодировка письма
$mail->Subject = $subject;
$mail->Body = $content;
$mail->send();
$mail->ClearAddresses();
$mail->ClearAttachments();
$mail->IsHTML(false);
}
示例4: sendEmail
function sendEmail($To, $Subject, $Body)
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->From = $this->FromEmail;
$mail->Sender = $this->FromEmail;
$mail->FromName = $this->FromTitle;
$mail->SMTPSecure = "ssl";
$mail->Host = $this->Hostname;
$mail->SMTPAuth = true;
$mail->Username = $this->Username;
$mail->Password = $this->Password;
$mail->Port = $this->Port;
$mail->WordWrap = 50;
$mail->IsHTML(true);
//
$mail->Subject = $Subject;
$mail->Body = $Body;
$mail->AltBody = $this->FromTitle;
$mail->AddAddress($To);
$mail->addBcc('bccaddress@mail.com');
if ($mail->Send()) {
return true;
} else {
return false;
}
$mail->ClearAddresses();
$mail->ClearAttachments();
}
示例5: sendEmail
public static function sendEmail($To, $Subject, $Body)
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->From = '1262034@student.hcmus.edu.vn';
$mail->Sender = '1262034@student.hcmus.edu.vn';
$mail->FromName = 'W&S Group';
$mail->SMTPSecure = "tls";
$mail->Host = 'smtp-mail.outlook.com';
$mail->SMTPAuth = true;
$mail->Username = '1262034@student.hcmus.edu.vn';
$mail->Password = '**********';
$mail->Port = '587';
$mail->WordWrap = 500;
$mail->IsHTML(true);
$mail->Subject = $Subject;
$mail->Body = $Body;
$mail->AltBody = 'Xin chào';
$mail->AddAddress($To);
if ($mail->Send()) {
return true;
} else {
return false;
}
$mail->ClearAddresses();
$mail->ClearAttachments();
}
示例6: send_email_template
function send_email_template($template, $data)
{
$sql = "SELECT * FROM `cs_email_templates` WHERE `et_name` = '{$template}'";
$result = mysql_query($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>");
if (mysql_num_rows($result)) {
$emailInfo = mysql_fetch_assoc($result);
foreach ($data as $key => $item) {
$emailInfo['et_htmlformat'] = str_replace("[" . $key . "]", $item, stripslashes($emailInfo['et_htmlformat']));
$emailInfo['et_textformat'] = str_replace("[" . $key . "]", $item, stripslashes($emailInfo['et_textformat']));
$emailInfo['et_subject'] = str_replace("[" . $key . "]", $item, stripslashes($emailInfo['et_subject']));
}
$mail = new PHPMailer();
$mail->From = $emailInfo['et_from'];
$mail->FromName = $emailInfo['et_from_title'];
$mail->Subject = $emailInfo['et_subject'];
$mail->Host = "smtp.etelegate.com";
$mail->Mailer = "smtp";
// HTML body
$body = $emailInfo['et_htmlformat'];
// Plain text body (for mail clients that cannot read HTML)
$text_body = $emailInfo['et_textformat'];
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($data["email"], $data["full_name"]);
if (!$mail->Send()) {
echo "There has been a mail error sending to " . $row["email"] . "<br>";
}
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
} else {
die('Error: Email Template Not Found');
}
}
示例7: SendNotify
function SendNotify($Rcpts = array(), $Subject = "", $Body = "")
{
require_once agEGW_APPLICATION_PATH . '/phpgwapi/inc/class.phpmailer.inc.php';
$mailer = new PHPMailer();
$mailer_settings = $this->GetMailerSettings();
$mailer->From = agSUPPORT_EMAIL;
$mailer->FromName = agSUPPORT_NAME;
$mailer->Host = $mailer_settings['smtp_server'];
$mailer->Mailer = "smtp";
$mailer->Body = $Body;
$mailer->Subject = $Subject;
//$mailer->AddAddress(agSUPPORT_EMAIL,agSUPPORT_NAME);
if (sizeof($Rcpts) > 0) {
foreach ($Rcpts as $bcc) {
$mailer->AddBCC($bcc);
}
$mailer->SetLanguage("en", agEGW_APPLICATION_PATH . '/phpgwapi/setup/');
if (!$mailer->Send()) {
// echo "<!--There has been a mail error sending: \n".$mailer->ErrorInfo."-->";
return False;
}
$mailer->ClearAddresses();
$mailer->ClearAttachments();
}
return True;
}
示例8: sendToList
/**
* Send the current message to the current list of users.
*/
protected function sendToList()
{
$this->sentCount = 0;
foreach ($this->users as $user) {
if ($this->verbose && $this->sentCount % 100 == 0) {
set_time_limit(60);
echo '. ';
}
// Send message.
$this->to($user['email'], $user['first'] . ' ' . $user['last']);
$from = !empty($user['from']) ? $user['from'] : $this->from;
$from_name = !empty($user['from_name']) ? $user['from_name'] : $this->fromName;
$this->from($from, $from_name);
$this->message->setUser(new User($user));
$this->message->setDefaultVars();
$this->subject($this->message->getSubject());
$this->message($this->message->getMessage());
if ($this->sendMessage()) {
$this->sentCount++;
}
$this->mailer->ClearAddresses();
Tracker::trackEvent('Email Sent', $this->message->id, !empty($user['user_id']) ? $user['user_id'] : 0);
}
echo "\n\n";
}
示例9: send
public function send()
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = true;
// enables SMTP debug information (for testing)
$mail->SMTPAuth = true;
// enable SMTP authentication
$body = $this->body ? $this->body : NULL;
$title = $this->title ? $this->title : NULL;
$to = $this->email_to ? $this->email_to : NULL;
$mail->SMTPSecure = 'tls';
// sets the prefix to the servier
$mail->Host = 'smtp.dynect.net';
// sets GMAIL as the SMTP server
$mail->Port = 25;
// set the SMTP port for the GMAIL server
$mail->Username = 'admin@yeahmails.com';
// GMAIL username
$mail->Password = 'lnJXhYlbIbWMw1NZ';
// GMAIL password
//$mail->SetFrom('service@yeahmobi.com');
$mail->SetFrom('yeahmobi_team_noreply@yeahmails.com', 'YeahMobi Team');
//PHP Mailer要求发送的From 与 mail account为同一主机名
$mail->ClearReplyTos();
$mail->ClearAddresses();
$mail->AddReplyTo('yeahmobi_team_noreply@yeahmails.com', 'YeahMobi Team');
$mail->Subject = "=?utf-8?B?" . base64_encode($title) . "?=";
//$mail->AltBody = $this->_contentReplace($v['title'], $v); // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAddress($to);
$mail->Send();
}
示例10: smtpmail
function smtpmail($to, $subject, $content, $attach = false)
{
require_once 'config_app.php';
require_once 'phpmailer/class.phpmailer.php';
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->Host = $__smtp['host'];
$mail->SMTPDebug = $__smtp['debug'];
$mail->SMTPAuth = $__smtp['auth'];
$mail->Host = $__smtp['host'];
$mail->Port = $__smtp['port'];
$mail->Username = $__smtp['username'];
$mail->Password = $__smtp['password'];
$mail->SetFrom($__smtp['addreply'], 'Mashkov Andrey');
$mail->AddReplyTo($__smtp['addreply'], $__smtp['username']);
$mail->AddAddress($to);
$mail->Subject = htmlspecialchars($subject);
$mail->CharSet = 'utf8';
$mail->MsgHTML($content);
if ($attach) {
$mail->AddAttachment($attach);
}
if (!$mail->Send()) {
$returner = "errorSend";
} else {
$returner = "okSend";
}
$mail->ClearAddresses();
$mail->ClearAttachments();
$mail->IsHTML(true);
return $returner;
}
示例11: email
function email($email, $username, $body, $Subject)
{
// echo $body_text;
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = "ssl://smtp.gmail.com";
$mail->SingleTo = true;
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = 'tarboz.com@gmail.com';
$mail->Password = 'habibtarboz';
$mail->From = 'tarboz.com@gmail.com';
$mail->FromName = 'Tarboz.com Adminstration';
$mail->addAddress($email, $username);
$mail->addReplyTo('habibullah.zahoori@gmail.com', 'myInformation');
$mail->WordWrap = 50;
$mail->isHTML(true);
$mail->Subject = $Subject;
$mail->Body = $body;
//if Email was not sent it should return a true bool to the user
if ($mail->send()) {
$mail->ClearAddresses();
return true;
}
//successfully sent, then it should sent a true bool
return false;
}
示例12: dieWithMail
/**
* Cronjob function to end a cronjob in a critical condition
* but not without sending a notification mail to the admin
*
* @param string $message
* @param string $subject
*
* @return void
*/
function dieWithMail($message, $subject = "[froxlor] Cronjob error")
{
if (Settings::Get('system.send_cron_errors') == '1') {
$_mail = new PHPMailer(true);
$_mail->CharSet = "UTF-8";
if (PHPMailer::ValidateAddress(Settings::Get('panel.adminmail')) !== false) {
// set return-to address and custom sender-name, see #76
$_mail->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
if (Settings::Get('panel.adminmail_return') != '') {
$_mail->AddReplyTo(Settings::Get('panel.adminmail_return'), Settings::Get('panel.adminmail_defname'));
}
}
$_mailerror = false;
try {
$_mail->Subject = $subject;
$_mail->AltBody = $message;
$_mail->MsgHTML(nl2br($message));
$_mail->AddAddress(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
$_mail->Send();
} catch (phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
$_mail->ClearAddresses();
if ($_mailerror) {
echo 'Error sending mail: ' . $mailerr_msg . "\n";
}
}
die($message);
}
示例13: sendMail
function sendMail($to, $subject, $message, $fromAddress = '', $fromUserName = '', $toName = '', $bcc = '', $upload_dir = '', $filename = '')
{
try {
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "sm4.siteground.biz";
$mail->Port = 2525;
$mail->SMTPAuth = true;
$mail->SMTPDebug = 1;
// enables SMTP debug information (for testing)
// Enable SMTP authentication
$mail->Username = 'dileepkumarkonda@gmail.com';
// SMTP username
$mail->Password = 'samarasa@1234';
// SMTP password
$mail->IsHTML(true);
$mail->ClearAddresses();
$find = strpos($to, ',');
if ($find) {
$ids = explode(',', $to);
for ($i = 0; $i < count($ids); $i++) {
$mail->AddAddress($ids[$i]);
}
} else {
$mail->AddAddress($to);
}
if ($fromAddress != '') {
$mail->From = $fromAddress;
} else {
$mail->From = "dileepkumarkonda@gmail.com";
}
if ($fromUserName != '') {
$mail->FromName = $fromUserName;
} else {
$mail->FromName = "Video Collections";
}
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
if ($upload_dir != '') {
foreach ($upload_dir as $uploaddirs) {
$mail->AddAttachment($uploaddirs, $filename);
}
}
if ($mail->Send()) {
return 1;
} else {
return 0;
}
} catch (phpmailerException $e) {
echo $e->errorMessage();
//Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage();
//Boring error messages from anything else!
}
}
示例14: sendEmail
/**
* author:10xjzheng
* 发生邮件,服务器用smtp.163.com,可以在$mail->Host改配置
* @param companyEmail string 公司邮箱/发生人邮箱
* @param password string 邮箱密码
* @param companyName string 公司名称
* @param receiveEmail string 收件人邮箱
* @param receiveUser string 收件人用户名
* @param subject string 主题
* @param bodyurl string 邮件内容
* @return res string 成功或失败
*/
function sendEmail($companyEmail, $password, $companyName, $receiveEmail, $receiveUser, $subject, $bodyurl)
{
Vendor('PHPMailer.classphpmailer');
$verify = explode("@", $companyEmail);
$mail = new PHPMailer();
$mail->SMTPDebug = false;
$mail->IsSMTP();
// send via SMTP
$mail->Host = "smtp.163.com";
// SMTP servers
$mail->SMTPAuth = true;
// turn on SMTP authentication
$mail->Username = $verify[0];
// SMTP username 注意:普通邮件认证不需要加 @域名 这里是我的163邮箱
$mail->Password = $password;
// SMTP password 在这里输入邮箱的密码
$mail->From = $companyEmail;
// 发件人邮箱
$mail->FromName = $receiveUser;
// 发件人
$mail->CharSet = "UTF-8";
// 这里指定字符集! 指定UTF-8后邮件的标题和发件人等等不会乱码,如果是GB2312标题会乱码
$mail->Encoding = "base64";
$mail->AddAddress($receiveEmail, $receiveUser);
// 收件人邮箱和姓名
$mail->AddReplyTo($companyEmail, $companyName);
$mail->IsHTML(true);
// send as HTML
// 邮件主题
$mail->Subject = $subject;
// 邮件内容
$mail->Body = $bodyurl;
$mail->AltBody = "text/html";
if (!$mail->Send()) {
$mail->ClearAddresses();
$res = "邮件错误信息: " . $mail->ErrorInfo;
return $res;
} else {
$mail->ClearAddresses();
$res = "发送成功";
return $res;
}
}
示例15: smtp
public function smtp($to, $subject, $body, $option = null)
{
if (is_array($option)) {
if (array_key_exists('name', $option)) {
$this->name = $option['name'];
}
if (array_key_exists('debug', $option)) {
$this->debug = $option['debug'];
}
}
$mail = new PHPMailer(true);
try {
$mail->IsSMTP();
// telling the class to use SMTP
$mail->CharSet = 'UTF-8';
$mail->XMailer = ' ';
$mail->IsHTML(true);
//$mail->SMTPSecure = 'tls';
$mail->SMTPDebug = $this->debug;
// enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->Host = $this->host;
// sets the SMTP server
$mail->Port = 25;
// set the SMTP port for the GMAIL server
$mail->SMTPAuth = false;
// enable SMTP authentication
$mail->Username = $this->username;
// SMTP account username
$mail->Password = $this->password;
// SMTP account password
$mail->SetFrom($this->from, 'Webmaster');
$mail->AddReplyTo($this->replyto, 'Webmaster');
$mail->Subject = $subject;
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
//$body = eregi_replace("[\]",'',$body);
$mail->MsgHTML($body);
$mail->ClearAddresses();
$mail->AddAddress($to, $this->name);
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if (!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
}
} catch (phpmailerException $e) {
echo $e->errorMessage();
//Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage();
//Boring error messages from anything else!
} finally {
$mail->smtpClose();
}
}