本文整理汇总了PHP中phpmailer::addAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP phpmailer::addAddress方法的具体用法?PHP phpmailer::addAddress怎么用?PHP phpmailer::addAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpmailer
的用法示例。
在下文中一共展示了phpmailer::addAddress方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: phpmailer
function f_SEND($t_email = '', $t_asunto = '', $t_contenido)
{
require_once '../modelo/phpmailer/class.phpmailer.php';
$a_email = new phpmailer();
$a_email->Mailer = "smtp";
$a_email->Host = "";
$a_email->SMTPAuth = true;
$a_email->Port = '465';
$a_email->CharSet = 'utf8';
$a_email->Username = '';
$a_email->Password = '';
$a_email->From = '';
$a_email->FromName = '' . utf8_decode('');
//escribir la el contenido del correo
//dirección destino
$a_correo = '' . $t_email;
$a_email->addAddress($a_correo);
$a_email->Subject = '' . utf8_decode('' . $t_asunto);
$a_email->AddEmbeddedImage('../imagenes/inen_header.png', 'logoinen', 'inen_header.png');
$a_email->IsHTML(true);
$a_email->Body = "<p><img src=\"cid:logoinen\" /></p><p>" . utf8_decode('' . $t_contenido) . "</p>";
$a_email->AltBody = ' ';
if ($a_email->send()) {
echo "</br>Mensaje enviado correctamente.</br>";
} else {
echo "<br/><strong>Información:</strong><br/>" . $a_email->ErrorInfo;
}
}
示例2: send_mail
function send_mail($email, $date, $time)
{
require '../phpmailer/PHPMailerAutoload.php';
$mail = new phpmailer();
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'sulemartin87@gmail.com';
$mail->Password = 'Kisamymum96';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('sulemartin87@gmail.com', 'Mailer');
$mail->addAddress('' . $email . '', 'user');
$mail->isHTML(true);
$mail->Subject = 'booking';
$mail->Body = 'This email is coming from global styling to: ' . $email . ' </br>
your booking is set for ' . $date . ' at ' . $time . '
thank you for booking with us. Global Styling';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if (!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent to your E-Mail address';
}
}
示例3: email_user
//.........这里部分代码省略.........
$smtphosts = get_config('smtphosts');
if ($smtphosts == 'qmail') {
// use Qmail system
$mail->IsQmail();
} else {
if (empty($smtphosts)) {
// use PHP mail() = sendmail
$mail->IsMail();
} else {
$mail->IsSMTP();
// use SMTP directly
$mail->Host = get_config('smtphosts');
if (get_config('smtpuser')) {
// Use SMTP authentication
$mail->SMTPAuth = true;
$mail->Username = get_config('smtpuser');
$mail->Password = get_config('smtppass');
}
}
}
if (get_config('bounces_handle') && isset($mailinfo->owner)) {
$mail->Sender = generate_email_processing_address($mailinfo->owner, $userto);
}
if (empty($userfrom) || $userfrom->email == get_config('noreplyaddress')) {
if (empty($mail->Sender)) {
$mail->Sender = get_config('noreplyaddress');
}
$mail->From = get_config('noreplyaddress');
$mail->FromName = isset($userfrom->id) ? display_name($userfrom, $userto) : get_config('sitename');
$customheaders[] = 'Precedence: Bulk';
// Try to avoid pesky out of office responses
$messagetext .= "\n\n" . get_string('pleasedonotreplytothismessage') . "\n";
if ($messagehtml) {
$messagehtml .= "\n\n<p>" . get_string('pleasedonotreplytothismessage') . "</p>\n";
}
} else {
if (empty($mail->Sender)) {
$mail->Sender = $userfrom->email;
}
$mail->From = $userfrom->email;
$mail->FromName = display_name($userfrom, $userto);
}
$replytoset = false;
if (!empty($customheaders) && is_array($customheaders)) {
foreach ($customheaders as $customheader) {
$mail->AddCustomHeader($customheader);
if (0 === stripos($customheader, 'reply-to')) {
$replytoset = true;
}
}
}
if (!$replytoset) {
$mail->AddReplyTo($mail->From, $mail->FromName);
}
$mail->Subject = substr(stripslashes($subject), 0, 900);
if ($to = get_config('sendallemailto')) {
// Admins can configure the system to send all email to a given address
// instead of whoever would receive it, useful for debugging.
$mail->addAddress($to);
$notice = get_string('debugemail', 'mahara', display_name($userto, $userto), $userto->email);
$messagetext = $notice . "\n\n" . $messagetext;
if ($messagehtml) {
$messagehtml = '<p>' . hsc($notice) . '</p>' . $messagehtml;
}
$usertoname = display_name($userto, $userto, true) . ' (' . get_string('divertingemailto', 'mahara', $to) . ')';
} else {
$usertoname = display_name($userto, $userto);
if (empty($userto->email)) {
throw new EmailException("Cannot send email to {$usertoname} with subject {$subject}. User has no primary email address set.");
}
$mail->AddAddress($userto->email, $usertoname);
$to = $userto->email;
}
$mail->WordWrap = 79;
if ($messagehtml) {
$mail->IsHTML(true);
$mail->Encoding = 'quoted-printable';
$mail->Body = $messagehtml;
$mail->AltBody = $messagetext;
} else {
$mail->IsHTML(false);
$mail->Body = $messagetext;
}
if ($mail->Send()) {
if ($logfile = get_config('emaillog')) {
$docroot = get_config('docroot');
@($client = (string) $_SERVER['REMOTE_ADDR']);
@($script = (string) $_SERVER['SCRIPT_FILENAME']);
if (strpos($script, $docroot) === 0) {
$script = substr($script, strlen($docroot));
}
$line = "{$to} <- {$mail->From} - " . str_shorten_text($mail->Subject, 200);
@error_log('[' . date("Y-m-d h:i:s") . "] [{$client}] [{$script}] {$line}\n", 3, $logfile);
}
// Update the count of sent mail
update_send_count($userto);
return true;
}
throw new EmailException("Couldn't send email to {$usertoname} with subject {$subject}. " . "Error from phpmailer was: " . $mail->ErrorInfo);
}
示例4: header
if (!isset($error_message) && !$mail->ValidateAddress($email)) {
$error_message = "Invalid Email Address";
}
if (!isset($error_message)) {
$email_body = "";
$email_body .= "Name: " . $name . "\n";
$email_body .= "Email: " . $email . "\n";
$email_body .= "Suggested Item\n";
$email_body .= "Category: " . $category . "\n";
$email_body .= "Title: " . $title . "\n";
$email_body .= "Format: " . $format . "\n";
$email_body .= "Genre: " . $genre . "\n";
$email_body .= "Year: " . $year . "\n";
$email_body .= "Details: " . $details . "\n";
$mail->setFrom($email, $name);
$mail->addAddress('info@daishodesign.com', 'Daisho');
// Add a recipient
$mail->isHTML(false);
// Set email format to HTML
$mail->Subject = 'Personal Media Library Suggestion from ' . $name;
$mail->Body = $email_body;
if ($mail->send()) {
header("location:suggest.php?status=thanks");
exit;
}
$error_message = 'Message could not be sent.';
$error_message .= 'Mailer Error: ' . $mail->ErrorInfo;
}
}
$pageTitle = "Suggest a Media Item";
$section = "suggest";
示例5: phpmailer
function send_mail()
{
require 'phpmailer/PHPMailerAutoload.php';
$email = "";
$mail = new phpmailer();
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'sulemartin87@gmail.com';
$mail->Password = 'Kisamymum96';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('sulemartin87@gmail.com', 'Mailer');
$mail->addAddress('martinsuleman@rocketmail.com', 'user');
$mail->isHTML(true);
$mail->Subject = 'The code works';
$mail->Body = 'This email is coming from <b> GLOBAL STYLING SALONS !! </b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if (!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent to your E-Mail address';
}
}
示例6: phpmailer
$mail = new phpmailer();
$mail->isSMTP();
// Set mailer to use SMTP
$mail->Host = SMTP_HOST;
// Specify main and backup SMTP servers
$mail->SMTPAuth = SMTP_AUTH;
// Enable SMTP authentication
$mail->Username = SMTP_USERNAME;
// SMTP username
$mail->Password = SMTP_PASSWORD;
// SMTP password
$mail->SMTPSecure = SMTP_SECURE;
// Enable TLS encryption, `ssl` also accepted
$mail->Port = SMTP_PORT;
// TCP port to connect to
$mail->From = $from;
$mail->FromName = APP_TITLE;
$mail->addAddress($to);
// Name is optional
$mail->isHTML(true);
// Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $html_text;
$mail->send();
$result = array("error" => false, "error_code" => ERROR_SUCCESS);
}
}
}
echo json_encode($result);
exit;
}
示例7: phpmailer
/*
get id for user
*/
require 'connection.php';
$query = $conn->prepare("SELECT email FROM messages WHERE id=?");
$query->bindValue(1, $id, PDO::PARAM_INT);
$query->execute();
$result = $query->fetch(PDO::FETCH_ASSOC);
extract($result);
require_once 'phpmailer/PHPMailerAutoload.php';
$m = new phpmailer();
$m->isSMTP();
$m->SMTPAuth = true;
$m->Host = 'smtpout.secureserver.net';
$m->username = 'jojoallowz';
$m->password = 'Jalal369allowz';
$m->SMTPSecure = 'ssl';
$m->Port = '465';
$m->From = 'admin@pixllart.com';
$m->FromName = 'pixllart.com';
$m->addReplyTo('', '');
$m->addAddress($email, '');
$m->isHtml(true);
$m->subject = 'frist message';
$m->Body = '<p>$msg</p><br><br> <img src="image/' . $img_name . '">';
$m->AltBody = '';
if ($m->send()) {
echo "sent";
} else {
echo $m->ErrorInfo;
}
示例8: email_user
/**
* Always use this function for all emails to users
*
* @param object $userto user object to send email to. must contain firstname,lastname,preferredname,email
* @param object $userfrom user object to send email from. If null, email will come from mahara
* @param string $subject email subject
* @param string $messagetext text version of email
* @param string $messagehtml html version of email (will send both html and text)
* @param array $customheaders email headers
* @throws EmailException
*/
function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml = '', $customheaders = null)
{
if (!get_config('sendemail')) {
// You can entirely disable Mahara from sending any e-mail via the
// 'sendemail' configuration variable
return true;
}
if (empty($userto)) {
throw new InvalidArgumentException("empty user given to email_user");
}
require_once 'phpmailer/class.phpmailer.php';
$mail = new phpmailer();
// Leaving this commented out - there's no reason for people to know this
//$mail->Version = 'Mahara ' . get_config('release');
$mail->PluginDir = get_config('libroot') . 'phpmailer/';
$mail->CharSet = 'UTF-8';
$smtphosts = get_config('smtphosts');
if ($smtphosts == 'qmail') {
// use Qmail system
$mail->IsQmail();
} else {
if (empty($smtphosts)) {
// use PHP mail() = sendmail
$mail->IsMail();
} else {
$mail->IsSMTP();
// use SMTP directly
$mail->Host = get_config('smtphosts');
if (get_config('smtpuser')) {
// Use SMTP authentication
$mail->SMTPAuth = true;
$mail->Username = get_config('smtpuser');
$mail->Password = get_config('smtppass');
}
}
}
if (empty($userfrom)) {
$mail->Sender = get_config('noreplyaddress');
$mail->From = $mail->Sender;
$mail->FromName = get_string('emailname');
$customheaders[] = 'Precedence: Bulk';
// Try to avoid pesky out of office responses
$messagetext .= "\n\n" . get_string('pleasedonotreplytothismessage') . "\n";
if ($messagehtml) {
$messagehtml .= "\n\n<p>" . get_string('pleasedonotreplytothismessage') . "</p>\n";
}
} else {
$mail->Sender = $userfrom->email;
$mail->From = $mail->Sender;
$mail->FromName = display_name($userfrom, $userto);
}
$replytoset = false;
if (!empty($customheaders) && is_array($customheaders)) {
foreach ($customheaders as $customheader) {
$mail->AddCustomHeader($customheader);
if (0 === stripos($customheader, 'reply-to')) {
$replytoset = true;
}
}
}
if (!$replytoset) {
$mail->AddReplyTo($mail->From, $mail->FromName);
}
$mail->Subject = substr(stripslashes($subject), 0, 900);
if ($to = get_config('sendallemailto')) {
// Admins can configure the system to send all email to a given address
// instead of whoever would receive it, useful for debugging.
$mail->addAddress($to);
$notice = get_string('debugemail', 'mahara', display_name($userto, $userto), $userto->email);
$messagetext = $notice . "\n\n" . $messagetext;
if ($messagehtml) {
$messagehtml = '<p>' . hsc($notice) . '</p>' . $messagehtml;
}
} else {
$usertoname = display_name($userto, $userto);
$mail->AddAddress($userto->email, $usertoname);
}
$mail->WordWrap = 79;
if ($messagehtml) {
$mail->IsHTML(true);
$mail->Encoding = 'quoted-printable';
$mail->Body = $messagehtml;
$mail->AltBody = $messagetext;
} else {
$mail->IsHTML(false);
$mail->Body = $messagetext;
}
if ($mail->Send()) {
return true;
//.........这里部分代码省略.........