本文整理汇总了PHP中phpmailer::AddAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP phpmailer::AddAddress方法的具体用法?PHP phpmailer::AddAddress怎么用?PHP phpmailer::AddAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpmailer
的用法示例。
在下文中一共展示了phpmailer::AddAddress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: activateUser
/**
* Activate a given user.
* @param $id Identifier of user.
* @param $activationKey Activation key for user.
*/
function activateUser($id, $activationKey)
{
if (!empty($id) && !empty($activationKey)) {
global $dbi;
global $lActivate;
$result = $dbi->query("SELECT username,activationKey FROM " . userTableName . " WHERE id=" . $dbi->quote($id));
if ($result->rows()) {
list($username, $activationKeyDB) = $result->fetchrow_array();
if ($activationKey == $activationKeyDB) {
$dbi->query("UPDATE " . userTableName . " SET registered=registered,lastUpdated=lastUpdated,lastLogged=lastLogged,activated=1,activationKey='' WHERE id=" . $dbi->quote($id));
// Send confirmation email
$result = $dbi->query("SELECT name,email FROM " . userDataTableName . " WHERE id=" . $dbi->quote($id));
if ($result->rows()) {
list($name, $email) = $result->fetchrow_array();
// Send activation email
$mail = new phpmailer();
$mail->CharSet = "UTF-8";
$mail->Sender = pageAdminMail;
$mail->From = pageAdminMail;
$mail->FromName = pageTitle;
$mail->Subject = $lActivate["MailSubject"];
$mail->Body = sprintf($lActivate["MailMessage"], $name, $username);
$mail->IsHTML(false);
$mail->AddAddress($email);
$mail->Send();
}
echo '<p>' . $lActivate["HeaderText"] . '</p>';
} else {
echo '<p>' . $lActivate["HeaderTextError"] . '</p>';
}
}
}
}
示例3: envmail
function envmail($email, $subject, $msg, $from, $fromname = "Opala Clube Franca")
{
require_once "class.phpmailer.php";
$mail = new phpmailer();
$mail->ClearAddresses();
$mail->ClearAllRecipients();
$mail->ClearAddresses();
$mail->ClearCustomHeaders();
$mail->IsSMTP();
// $mail->IsSendmail();
$mail->From = $from;
$mail->FromName = $fromname;
// $mail->Hostname = "smtp.gmail.com";
// $mail->Host = "smtp.gmail.com";
$mail->SMTPSecure = "ssl";
$mail->Hostname = "smtp.opalaclubefranca.com.br";
$mail->Host = "smtp.opalaclubefranca.com.br";
// $mail->SMTPDebug = 2;
$mail->Username = "admin@opalaclubefranca.com.br";
$mail->Password = "racnela";
$mail->SMTPAuth = true;
$mail->Port = 465;
$mail->Timeout = 120;
$body = $msg;
$text_body = $msg;
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AltBody = $text_body;
if (is_array($email)) {
foreach ($email as $em) {
$mail->AddAddress($em, "");
}
} else {
$mail->AddAddress($email, "");
}
/* echo '<tr><td>To '.$email.'</td></tr>'."\n";
echo '<tr><td>Assunto '.$subject.'</td></tr>'."\n";
echo '<tr><td>Mensagem '.$msg.'</td></tr>'."\n";
echo '<tr><td>From '.$from.'</td></tr>'."\n";
*/
$exito = $mail->Send();
$v = 0;
// echo "<tr><td>ErrorInfo " . $mail->ErrorInfo . "<br></td></tr>";
while (!$exito && $v < 5 && $mail->ErrorInfo != "SMTP Error: Data not accepted.") {
sleep(2);
$exito = $mail->Send();
echo "<tr><td>ErrorInfo " . $mail->ErrorInfo . "<br></td></tr>";
$v = $v + 1;
}
if (!$exito) {
echo "<tr><td>There has been a mail error sending to " . $mail->ErrorInfo . "<br></td></tr>";
}
$mail->ClearAddresses();
$mail->ClearAttachments();
return $mail->ErrorInfo;
}
示例4: SetAdress
/**
* Устанавливает единственный адрес получателя
*
* @param string $sMail Емайл
* @param string $sName Имя
*/
public function SetAdress($sMail, $sName = null)
{
$this->ClearAddresses();
ob_start();
$this->oMailer->AddAddress($sMail, $sName);
$this->sError = ob_get_clean();
}
示例5: sendQRmail
function sendQRmail($from, $to, $subject, $msg, $qrcodeImage, $cid, $name)
{
include_once 'inc/class.phpmailer.php';
$mail = new phpmailer();
$mail->SMTPDebug = 0;
// debugging: 1 = errors and messages, 2 = messages only, 0 = off
$mail->IsSMTP();
// Set mailer to use SMTP
$mail->Host = 'mailhub.eait.uq.edu.au';
// Specify server
$mail->Port = 25;
// Server port: 465 ssl OR 587 tls
//$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->SMTPAuth = false;
// Enable SMTP authentication
$mail->Username = 's4329663@student.uq.edu.au';
// SMTP username
$mail->Password = 'hongzhe123999';
// SMTP password
$mail->SetFrom($from, 'QRappi');
// Sender
$mail->AddReplyTo($from, 'Support');
// Set an alternative reply-to address
$mail->AddAddress($to, 'User');
// Set who the message is to be sent to
$mail->Subject = $subject;
// Set the subject line
// Prepares message for html (see doc for details http://phpmailer.worxware.com/?pg=tutorial)
$mail->MsgHTML($msg);
// Add the image to the email as an inline element (i.e. not as an attachment)
$mail->AddStringEmbeddedImage($qrcodeImage, $cid, $name);
// Send the message, check for errors
$ok = $mail->Send();
return $ok;
}
示例6: sendmail
function sendmail($subject, $mailcontent, $receiver, $receivername, $attachment = "")
{
if (strpos($_SERVER['HTTP_HOST'], "localhost")) {
return false;
}
$mail = new phpmailer();
$mail->IsSMTP();
$mail->Host = "mail.pepool.com";
$mail->Port = 2525;
$mail->SMTPAuth = true;
$mail->Username = "info+pepool.com";
// Write SMTP username in ""
$mail->Password = "*VTWqNzPNKlut";
$mail->Mailer = "smtp";
$mail->IsHTML(true);
$mail->ClearAddresses();
$mail->From = "info@pepool.com";
$mail->FromName = "pepool";
$mail->Subject = $subject;
$mail->Body = $mailcontent;
$mail->AddAddress($receiver, $receivername);
if ($attachment != '') {
$mail->AddAttachment($attachment);
}
$suc = $mail->Send();
return $suc > 0;
}
示例7: proc_upd
public function proc_upd()
{
$obj = ormPages::get(system::POST('obj_id'));
$obj->tabuList('pseudo_url', 'h1', 'keywords', 'title', 'description', 'active', 'is_home_page', 'view_in_menu', 'view_submenu', 'in_search', 'in_index', 'in_new_window', 'other_link', 'img_act', 'img_no_act', 'img_h1');
$obj->loadFromPost();
// Публикация на сайте
if (system::POST('publ', isBool)) {
if ($obj->isInheritor('faq') && $obj->newVal('answer') == '') {
ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), lang::get('FEEDBACK_MSG_3'));
ui::selectErrorFields(array('select' => '', 'focus' => 'answer'));
} else {
$obj->active = 1;
}
}
$obj_id = $obj->save();
// Если объект не сохранился, выводим пользователю текст ошибки.
if ($obj_id === false) {
system::savePostToSession();
ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), $obj->getErrorListText());
ui::selectErrorFields($obj->getErrorFields());
system::redirect('/feedback/message_upd/' . $_POST['obj_id']);
}
if (system::POST('send_to_email', isBool) && !$obj->send_answer_to_user && ($form_obj = ormObjects::get($obj->form_id))) {
if ($form_obj->send_answer) {
if ($obj->answer != '') {
$fields = $obj->getClass()->loadFields();
while (list($num, $field) = each($fields)) {
if (!empty($field['f_sname'])) {
page::assign($field['f_sname'], $obj->__get($field['f_sname']));
}
}
page::assign('site_name', domains::curDomain()->getSiteName());
page::assign('base_email', domains::curDomain()->getEmail());
$mail = new phpmailer();
$mail->From = $this->parse($form_obj->answer_sender_address);
$mail->FromName = $this->parse($form_obj->answer_sender_name);
$mail->AddAddress($obj->email);
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = $this->parse($form_obj->answer_subject);
$mail->Body = $this->parse($form_obj->answer_template);
$mail->Send();
// Помечаем, что ответ отправлен
$obj->send_answer_to_user = 1;
$obj->save();
ui::MessageBox(lang::get('FEEDBACK_MSG_1'), '');
} else {
ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), lang::get('FEEDBACK_MSG_2'));
ui::selectErrorFields(array('select' => '', 'focus' => 'answer'));
}
}
}
// Если данные изменились корректно перенаправляем на соответствующию страницу
if ($_POST['parram'] == 'apply') {
system::redirect('/feedback/message_upd/' . $obj_id);
} else {
system::redirect('/feedback');
}
}
示例8: fu_envia_clave
function fu_envia_clave($nom, $email, $email_ins, $user, $clave, $tipo)
{
require_once "class.phpmailer.php";
$mail = new phpmailer();
$mail->From = "computo@udistrital.edu.co";
$mail->FromName = "Oficina Asesora de Sistemas";
$mail->Host = "mail.udistrital.edu.co";
$mail->Mailer = "smtp";
$mail->SMTPAuth = true;
$mail->Username = "computo@udistrital.edu.co";
$mail->Password = "capitaloas2011";
$mail->Timeout = 120;
$mail->Charset = "utf-8";
$mail->IsHTML(false);
if ($tipo == 4) {
$tip = "Coordinador";
} elseif ($tipo == 16) {
$tip = "Decano";
} elseif ($tipo == 24) {
$tip = "Funcionario";
} elseif ($tipo == 26) {
$tip = "Proveedor";
} elseif ($tipo == 30) {
$tip = "Docente";
} elseif ($tipo == 51) {
$tip = "Estudiante";
}
//echo "tipo en fua_ ".$tipo; exit;
$fecha = date("d-M-Y h:i:s A");
$comen = "Mensaje generado automáticamente por el servidor de la Oficina Asesora de Sistemas.\n";
$comen .= "Este es su usuario y clave para ingresar al Sistema de Información Cóndor.\n\n";
$comen .= "Por seguridad cambie la clave.\n\n";
$sujeto = "Clave";
$cuerpo = "Fecha de envio: " . $fecha . "\n\n";
$cuerpo .= "Señor(a) : " . $nom . "\n\n";
$cuerpo .= $comen . "\n\n";
$cuerpo .= "Tipo: " . $tip . "\n";
$cuerpo .= "Usuario: " . $user . "\n";
$cuerpo .= "Clave Acceso: " . $clave . "\n";
$mail->Body = $cuerpo;
$mail->Subject = $sujeto;
$mail->AddAddress($email);
$mail->AddCC($email_ins);
if (!$mail->Send()) {
header("Location: {$redir}?error_login=16");
} else {
header("Location: {$redir}?error_login=18");
}
$mail->ClearAllRecipients();
}
示例9: SendMail
function SendMail($email, $name, $subject, $message)
{
global $sockethost, $smtpauth, $smtpauthuser, $smtpauthpass, $socketfrom, $socketfromname, $socketreply, $socketreplyname;
include 'class.phpmailer.php';
$mail = new phpmailer();
$mail->IsSMTP();
$mail->Host = $sockethost;
if ($smtpauth == 'TRUE') {
$mail->SMTPAuth = true;
$mail->Username = $smtpauthuser;
$mail->Password = $smtpauthpass;
}
if (isset($_GET['caseid']) && ($_GET['caseid'] == 'NewTicket' || $_GET['caseid'] == 'view')) {
$mail->From = $email;
$mail->FromName = $name;
$mail->AddReplyTo($email, $name);
} else {
$mail->From = $socketfrom;
$mail->FromName = $socketfromname;
$mail->AddReplyTo($socketreply, $socketreplyname);
}
$mail->IsHTML(False);
$mail->Body = $message;
$mail->Subject = $subject;
if (isset($_GET['caseid']) && ($_GET['caseid'] == 'NewTicket' || $_GET['caseid'] == 'view')) {
$mail->AddAddress($socketfrom, $socketfromname);
} else {
$mail->AddAddress($email, $name);
}
if (!$mail->Send()) {
return 'Error: ' . $mail->ErrorInfo;
} else {
return 'Email Sent.';
}
$mail->ClearAddresses();
}
示例10: sendmail
public function sendmail($from, $to, $subject, $body, $altbody = null, $options = null, $attachments = null, $html = false)
{
if (!is_array($from)) {
$from = array($from, $from);
}
$mail = new phpmailer();
$mail->PluginDir = 'M/lib/phpmailer/';
if ($this->getConfig('smtp')) {
$mail->isSMTP();
$mail->Host = $this->getConfig('smtphost');
if ($this->getConfig('smtpusername')) {
$mail->SMTPAuth = true;
$mail->Port = $this->getConfig('smtpport') ? $this->getConfig('smtpport') : 25;
$mail->SMTPDebug = $this->smtpdebug;
$mail->Username = $this->getConfig('smtpusername');
$mail->Password = $this->getConfig('smtppassword');
}
}
$mail->CharSet = $this->getConfig('encoding');
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->Body = $note . $body;
$mail->AltBody = $altbody;
if (!is_array($from)) {
$from = array($from, $from);
}
$mail->From = $from[0];
$mail->FromName = $from[1];
if (key_exists('reply-to', $options)) {
$mail->AddReplyTo($options['reply-to']);
unset($options['reply-to']);
}
if (key_exists('Sender', $options)) {
$mail->Sender = $options['Sender'];
}
if (null != $attachments) {
if (!is_array($attachments)) {
$attachments = array($attachments);
}
foreach ($attachments as $k => $v) {
if (!$mail->AddAttachment($v, basename($v))) {
trigger_error("Attachment {$v} could not be added");
}
}
}
$mail->IsHTML($html);
$result = $mail->send();
}
示例11: a2b_mail
function a2b_mail($to, $subject, $mail_content, $from = 'root@localhost', $fromname = '', $contenttype = 'multipart/alternative')
{
$mail = new phpmailer();
$mail->From = $from;
$mail->FromName = $fromname;
//$mail -> IsSendmail();
//$mail -> IsSMTP();
$mail->Subject = $subject;
$mail->Body = nl2br($mail_content);
//$HTML;
$mail->AltBody = $mail_content;
// Plain text body (for mail clients that cannot read HTML)
// if ContentType = multipart/alternative -> HTML will be send
$mail->ContentType = $contenttype;
$mail->AddAddress($to);
$mail->Send();
}
示例12: sendList
function sendList($list)
{
// send email of message
global $loader, $intl, $conf;
$loader->import('saf.Ext.phpmailer');
$mail = new phpmailer();
$mail->IsMail();
$mail->IsHTML(true);
foreach ($list as $item) {
if (strtoupper($item->type) == 'TASK') {
$id = 'T' . $item->id;
} elseif (strtoupper($item->type) == 'MESSAGE') {
$id = 'M' . $item->id;
} else {
$id = strtoupper(substr($item->type, 0, 1)) . $item->id;
}
$mail->From = $conf['Messaging']['return_address'];
//$mail->Subject = '[' . $this->id . '] ' . $this->subject;
//$mail->Body = $this->body;
$mail->AddAddress($item->address);
if (defined('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_SUBJECT')) {
$mail->Subject = $intl->get(constant('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_SUBJECT'), $item->struct);
} else {
$mail->Subject = '[' . $id . '] ' . $item->subject;
}
if (defined('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_BODY')) {
$mail->Body = $intl->get(constant('WORKSPACE_' . strtoupper($item->type) . '_' . strtoupper($this->name) . '_BODY'), $item->struct);
} else {
$mail->Body = $item->body;
}
if ($item->priority == 'urgent' || $item->priority == 'high') {
$mail->Priority = 1;
} else {
$mail->Priority = 3;
}
if (!$mail->Send()) {
$this->error = $mail->ErrorInfo;
return false;
}
$mail->ClearAddresses();
$mail->ClearAttachments();
}
return true;
}
示例13: sendEmail
protected function sendEmail($to, $subject, $body)
{
include_once '../../libraries/phpmailer/class.phpmailer.php';
if (empty($to)) {
return false;
}
$mail = new phpmailer();
$mail->PluginDir = '../../libraries/phpmailer';
$mail->CharSet = 'UTF-8';
$mail->Subject = substr(stripslashes($subject), 0, 900);
$mail->From = 'noreply@arisgames.org';
$mail->FromName = 'ARIS Mailer';
$mail->AddAddress($to, 'ARIS Author');
$mail->MsgHTML($body);
$mail->WordWrap = 79;
if ($mail->Send()) {
return true;
} else {
return false;
}
}
示例14: send
function send($newsletter_id)
{
global $db;
$owpDBTable = owpDBGetTables();
$send_mail = new phpmailer();
$send_mail->From = OWP_EMAIL_ADDRESS;
$send_mail->FromName = OWP_NAME;
$send_mail->Subject = $this->title;
$sql = "SELECT admin_gender, admin_firstname, admin_lastname,\n admin_email_address \n FROM " . $owpDBTable['administrators'] . " \n WHERE admin_newsletter = '1'";
$mail_values = $db->Execute($sql);
while ($mail = $mail_values->fields) {
$send_mail->Body = $this->content;
$send_mail->AddAddress($mail['admin_email_address'], $mail['admin_firstname'] . ' ' . $mail['admin_lastname']);
$send_mail->Send();
// Clear all addresses and attachments for next loop
$send_mail->ClearAddresses();
$send_mail->ClearAttachments();
$mail_values->MoveNext();
}
$today = date("Y-m-d H:i:s");
$db->Execute("UPDATE " . $owpDBTable['newsletters'] . " \n SET date_sent = " . $db->DBTimeStamp($today) . ",\n status = '1' \n WHERE newsletters_id = '" . owpDBInput($newsletter_id) . "'");
}
示例15: phpmailer
function send_email($content)
{
require "PHPMailer/class.phpmailer.php";
//Instanciamos un objeto de la clase phpmailer
$mail = new phpmailer();
//Indicamos a la clase phpmailer donde se encuentra la clase smtp
//$mail->PluginDir = "";
//Indicamos que vamos a conectar por smtp
$mail->Mailer = "smtp";
$mail->CharSet = "UTF-8";
//Nuestro servidor smtp. Como ves usamos cifrado ssl
$mail->Host = "ssl://smtp.gmail.com";
//Puerto de gmail 465
$mail->Port = "465";
//Le indicamos que el servidor smtp requiere autenticación
$mail->SMTPAuth = true;
//Le decimos cual es nuestro nombre de usuario y password
$mail->Username = "thlink.desarrollo@gmail.com";
$mail->Password = "Thlink0013";
//Indicamos cual es nuestra dirección de correo y el nombre que
//queremos que vea el usuario que lee nuestro correo
$mail->From = "contacto@inbest.me";
$mail->FromName = "Nuevo registro en iNBest";
//El valor por defecto de Timeout es 10, le voy a dar un poco mas
$mail->Timeout = 30;
//Indicamos cual es la dirección de destino del correo.
$mail->AddAddress("Inbest@inbest.me");
//$mail->AddCC("contacto@sths.com.mx");
//Asignamos asunto
$mail->Subject = "Nuevo Registro a través del sitio de iNBest - Solicita más Información";
//Cuerpo del mensaje. Puede contener html
$mail->Body = $content;
//Si no admite html
$mail->AltBody = "Cuerpo de mensaje solo texto";
//Envia en email
$resultado = $mail->Send();
}