本文整理汇总了PHP中PHPMailer::msgHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::msgHTML方法的具体用法?PHP PHPMailer::msgHTML怎么用?PHP PHPMailer::msgHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::msgHTML方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Send email
* @param array $to
* @param array $from
* @param string $subject
* @param string $text
* @param bool $use_template
* @return bool
*/
public function send($to, $from, $subject, $text, $use_template = true)
{
$this->client->setFrom($from[1], $from[0]);
$this->client->addAddress($to[1], $to[0]);
$this->client->Subject = $subject;
if ($use_template) {
$template = '
<!DOCTYPE HTML>
<html dir="rtl">
<head>
<meta charset="utf-8">
</head>
<body style="font-family: tahoma, sans-serif !important;">
<div style="font: 13px tahoma,sans-serif !important;direction: rtl;background-color: #e8e8e8;">
<div style="width: 70%;background-color: #fff;background-color: #fff; border-radius: 3px;margin: auto;position: relative;border-left: 1px solid #d9d9d9;border-right: 1px solid #d9d9d9;">
<div style="top: 0;position: absolute;width: 100%; height: 4px;background: url( \'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAECAYAAAD8kH0gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGhJREFUeNpi/P///xkGKFh27TfDkiu/GQiBKC1WhhgdVoLqXkzsZHje30ZQnUR+OYNkYRVWORZkxy0DOo6JgGERpDhuYgcDAxN+EyVyS3E6DgSYkB3HQG3HEQo5Ao4DO3AwOw4EAAIMAMZJM9nl1EbWAAAAAElFTkSuQmCC\' ) repeat;"></div>
<div style="padding: 22px 15px;">
{TEXT}
</div>
<div style="bottom: 0;position: absolute;width: 100%; height: 4px;background: url( \'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAECAYAAAD8kH0gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGhJREFUeNpi/P///xkGKFh27TfDkiu/GQiBKC1WhhgdVoLqXkzsZHje30ZQnUR+OYNkYRVWORZkxy0DOo6JgGERpDhuYgcDAxN+EyVyS3E6DgSYkB3HQG3HEQo5Ao4DO3AwOw4EAAIMAMZJM9nl1EbWAAAAAElFTkSuQmCC\' ) repeat;"></div>
</div>
</div>
</body>
</html>
';
$msg = str_replace('{TEXT}', $text, $template);
} else {
$msg = $text;
}
$this->client->msgHTML($msg);
return $this->client->send();
}
示例2: setContent
/**
* Informa o conteúdo da mensagem
* @param type $assunto
* @param type $mensagem
*/
public function setContent($assunto = null, $mensagem = null)
{
if (!empty($assunto)) {
$this->SMTP->Subject = $assunto;
}
$this->SMTP->Body = "<!doctype html><html><head><title>{$assunto}</title><meta charset='UTF-8' /></head><body>{$mensagem}</body></html>";
$this->SMTP->msgHTML($mensagem);
}
示例3: message
/**
* Set the message body
*
* Multiple bodies with different types can be added by calling this method
* multiple times. Every email is required to have a "plain" message body.
*
* @param string $body New message body
* @param string $type Mime type: text/html, text/plain [Optional]
* @return Email
*/
public function message($body, $type = NULL)
{
if (!$type or $type === 'text/plain') {
// Set the main text/plain body
$this->_mail->Body = $body;
} else {
// Add a custom mime type
$this->_mail->msgHTML($body);
}
return $this;
}
示例4: enviarCorreoPosiciones
public function enviarCorreoPosiciones($nombre, $correo)
{
include 'conexion.php';
$stmt = $pdo->prepare("SELECT id_usuario from usuarios where nombre = '{$nombre}' and correo = '{$correo}'");
$stmt->execute();
$user = $stmt->fetch(PDO::FETCH_ASSOC);
$cont = "SELECT id_usuario,longitud,latitud,tiempo FROM posiciones where id_usuario= " . $user['id_usuario'];
$stmt2 = $pdo->prepare($cont);
$stmt2->execute();
$correoAenviar = "<table border='1'><tr><th>ID_Usuario</th><th>Longitud</th><th>Latitud</th><th>Tiempo</th></tr>";
foreach ($stmt2->fetchAll(PDO::FETCH_ASSOC) as $row) {
$correoAenviar .= "<tr><td>" . $row['id_usuario'] . "</td><td>" . $row['longitud'] . "</td><td>" . $row['latitud'] . "</td><td>" . $row['tiempo'] . "</td></tr>";
}
$correoAenviar .= "</table>";
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPAuth = true;
//$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.live.com";
$mail->Port = 587;
$mail->Username = "";
$mail->Password = "";
$mail->From = "";
$mail->FromName = "";
$mail->Subject = "Posiciones App Tracking";
$mail->AltBody = "Mensaje de prueba";
$mail->msgHTML($correoAenviar);
$mail->addAddress($correo, $nombre);
$mail->isHTML(true);
if (!$mail->send()) {
echo "Error: " . $mail->ErrorInfo;
}
}
示例5: EnviaCorreos_Chat
function EnviaCorreos_Chat($Usuario, $mailCliente, $strReclamacion, $strComentario)
{
require '../general/phpmailer/PHPMailerAutoload.php';
$from = 'soporte@qualidad.com';
$mail = new PHPMailer();
//Correo desde donde se envía (from)
$mail->setFrom($from, '');
//Correo de envío (to)
$mail->addAddress($mailCliente, '');
$mail->CharSet = "UTF-8";
$mail->Subject = 'Sistema de Calidad. Envío de claves';
$strHTML = '<table width="440" border="0" height="22" class="txtgeneral">';
$strHTML = $strHTML . "<tr><td>Ese correo a sido enviado por el usuario: {$Usuario}</td></tr>";
$strHTML = $strHTML . "<tr><td>Es un comentario de la reclamacion: {$strReclamacion}</td></tr>";
$strHTML = $strHTML . "<tr><td>Con fecha de: " . date('d/m/Y') . "</td></tr>";
$strHTML = $strHTML . "<tr><td></td></tr>";
$strHTML = $strHTML . "<tr><td></td></tr>";
$strHTML = $strHTML . "<tr><td>{$strComentario}</td></tr>";
$strHTML = $strHTML . '</td></tr>';
$strHTML = $strHTML . '<tr><td>Departamento de Calidad</td></tr>';
$strHTML = $strHTML . '<tr><td><center><IMG SRC="http://www.qualidad.info/qualidad/images/logo-' . $_SESSION['base'] . '.jpg" width="132" height="67" BORDER="0"></center>';
$strHTML = $strHTML . '</td></tr>';
$strHTML = $strHTML . '</TABLE>';
$strHTML = '<HTML><BODY><font face=""Verdana, Arial, Helvetica, sans-serif"" size=""-1"">' . $strHTML . '</font></BODY></HTML>';
$mail->msgHTML($strHTML);
$mail->send();
}
示例6: SendEmail
public function SendEmail($account, $type)
{
$email = new \PHPMailer();
$email->isSMTP();
// $email->Timeout = 120;
//$email->SMTPDebug = 2;
//$email->Debugoutput = 'html';
$email->Host = "smtp.gmail.com";
$email->Port = 587;
$email->SMTPSecure = "tls";
$email->SMTPAuth = true;
$email->Username = "team-developers@c-developers.com";
$email->Password = "ChNtLdVlPrS20E#";
$email->setFrom("team-developers@c-developers.com", "Retos");
$email->addReplyTo("team-developers@c-developers.com", "Retos");
$email->addAddress("{$account}");
$email->isHTML(true);
$email->Subject = "Retos | Chontal Developers";
$file = dirname(__DIR__) . "/views/email/index.html";
$email->msgHTML(file_get_contents($file));
if ($type == 1) {
$email->AltBody = "Gracias por contactarnos en breve nos comunicaremos con usted. Les agradece El equipo Retos.";
} else {
if ($type == 2) {
$email->AltBody = "Gracias por suscribirse a nuestro sito http://www.retos.co";
}
}
if (!$email->send()) {
//echo 'Message could not be sent.';
//echo 'Mailer Error: ' . $email->ErrorInfo;
} else {
return true;
}
}
示例7: success
public function success($type, $id, $transactionid, $a = "search")
{
DB::table($type . "_transaction")->where("id", $transactionid)->update(array("status" => 1));
DB::table("overall_transaction")->where("related_transaction_id", $transactionid)->update(array("status" => 1));
$transaction = DB::table($type . "_transaction")->where("id", $transactionid)->first();
$owner = DB::table('users')->join($type, $type . '.user_id', '=', 'users.id')->select('users.email')->first();
$mail = new PHPMailer();
$mail->setFrom(Config::get("app.support_email"));
$mail->addAddress($owner->email);
$body = "<style>\n\t\t\t\t\t* {\n\t\t\t\t\t\tfont-family: Arial;\n\t\t\t\t\t}\n\t\t\t\t\ttable {\n\t\t\t\t\t\tfont-size: 12px;\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t<h4>You have a new donation from " . $transaction->name . ".</h4>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Name: </td>\n\t\t\t\t\t\t<td>" . $transaction->name . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Email: </td>\n\t\t\t\t\t\t<td>" . $transaction->email . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Amount: </td>\n\t\t\t\t\t\t<td>" . $transaction->amount . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'>Transaction : </td>\n\t\t\t\t\t\t<td><a href='" . Config::get("app.url") . "projects/" . $type . "/" . $id . "/transactions'>Click to go.</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>";
$mail->Subject = "Christian Response: You have a new donation.";
$mail->msgHTML($body);
$mail->AltBody = $body;
$mail->send();
if (Auth::check()) {
//return View::make("/frontend/" . $this -> _permission[Auth::user() -> permission] . "/donation/success") -> with(array("active" => "", "redirect_url" => "/dashboard/project/view/" . $type . "/" . $id, "type" => "Project"));
$error = "<div class='alert alert-success alert-dismissable'>\n <button aria-hidden='true' data-dismiss='alert' class='close' type='button'>×</button>\n Thank you for your support in this project.\n </div>";
Session::set("error", $error);
if ($a == "search") {
return Redirect::to("/search/project/" . $type . "/view/" . $id);
} elseif ($a == "dashboard") {
return Redirect::to("/dashboard/project/view/" . $type . "/" . $id);
}
} else {
Session::set("error", $this->responsebox("Thank you for your support!.", "success"));
return Redirect::to("/project/view/" . strtolower($type) . "/" . $id);
}
}
示例8: sendMail
/**
* Sends the message
* @param string $email
* @param string $subject
* @param string $message with html markup
* @return bool
* @throws Exception
* @throws phpmailerException
*/
function sendMail($email, $subject, $message)
{
//create a new PHPMailer instance
$mail = new PHPMailer();
//tell PHPMailer to use SMTP
$mail->isSMTP();
//enable debugging...
$mail->SMTPDebug = 0;
//ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//set the hostname of the server
$mail->Host = 'smtp.gmail.com';
//set SMTP port number
$mail->Port = 587;
//set encryption
$mail->SMTPSecure = 'tls';
//use SMTP authentication
$mail->SMTPAuth = true;
//Username
$mail->Username = 'jrk.phpmailer@gmail.com';
//Password
$mail->Password = 'RH6snj.oKb^';
//Set FROM field
$mail->setFrom('jrk.phpmailer@gmail.com', 'Jerry Krusinski');
//Set TO field
$mail->addAddress($email);
//Set the SUBJECT
$mail->Subject = $subject;
//Set Message
$mail->msgHTML($message);
//Send Message, Check for errors
return $mail->send();
}
示例9: send
/**
* Функция отправки сообщения:
*
* @param string $from - адрес отправителя
* @param string $from_name - имя отправителя
* @param string|array $to - адрес(-а) получателя
* @param string $theme - тема письма
* @param string $body - тело письма
* @param bool $isText - является ли тело письма текстом
*
* @return bool отправилось ли письмо
**/
public function send($from, $from_name, $to, $theme, $body, $isText = false)
{
$this->_mailer->clearAllRecipients();
$this->setFrom($from, $from_name);
if (is_array($to)) {
foreach ($to as $email) {
$this->addAddress($email);
}
} else {
$this->addAddress($to);
}
$this->setSubject($theme);
if ($isText) {
$this->_mailer->Body = $body;
$this->_mailer->isHTML(false);
} else {
$this->_mailer->msgHTML($body, \Yii::app()->basePath);
}
try {
return $this->_mailer->send();
} catch (\Exception $e) {
\Yii::log($e->__toString(), \CLogger::LEVEL_ERROR, 'mail');
return false;
}
}
示例10: send_mail
function send_mail($Host, $Port, $Secure, $Auth, $TitleMail, $Username, $Password, $ToName, $ToEmail, $Charset, $Subject, $Body)
{
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->Debugoutput = 'html';
$mail->Host = $Host;
$mail->Port = $Port;
$mail->SMTPSecure = $Secure;
$mail->SMTPAuth = $Auth;
$mail->Username = $Username;
$mail->Password = $Password;
$mail->setFrom($Username, $TitleMail);
$mail->addReplyTo($ToEmail, $ToName);
$mail->addAddress($Username, "");
$mail->CharSet = $Charset;
$mail->Subject = $Subject;
$body = mb_convert_encoding($Body, mb_detect_encoding($Body), 'UTF-8');
$mail->msgHTML($body);
$mail->AltBody = 'This is a plain-text message body';
if (!$mail->send()) {
$result = "Mailer Error: " . $mail->ErrorInfo . ' ' . $mymail;
} else {
$result = true;
}
return $result;
}
示例11: sendWelcomeEmail
function sendWelcomeEmail($email)
{
$mail = new PHPMailer();
$mail->IsSMTP();
// set mailer to use SMTP
$mail->Debugoutput = 'html';
$mail->Host = "sub5.mail.dreamhost.com";
// specify main and backup server
$mail->Port = 587;
$mail->SMTPAuth = true;
// turn on SMTP authentication
$mail->Username = "admin@roscr.com";
// SMTP username
$mail->Password = "roscrsaving";
// SMTP password
$mail->setFrom("admin@roscr.com", "Roscr Admin");
$mail->AddAddress($email);
$mail->IsHTML(true);
// set email format to HTML
$mail->msgHTML(file_get_contents('welcome.html'), dirname(__FILE__));
$mail->AltBody = $emailText;
$mail->Subject = "Subscription to ROSCr";
$mail->WordWrap = 50;
// set word wrap to 50 characters
if (!$mail->Send()) {
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
}
示例12: onLoad
public function onLoad($param)
{
parent::onLoad($param);
$checkNewsletter = nNewsletterRecord::finder()->findByStatus(1);
if ($checkNewsletter) {
$layout = nLayoutRecord::finder()->findBy_nNewsletterID($checkNewsletter->ID);
$mail = new PHPMailer();
$mail->isSendmail();
$mail->setFrom('from@vp.d2.pl', 'First Last');
$mail->addReplyTo('from@vp.d2.pl');
$lista = nSenderRecord::finder()->findAll('nLayoutID = ? AND Status = 0 LIMIT 25', $layout->ID);
foreach ($lista as $person) {
$mail->addAddress($person->Email);
$mail->Subject = $checkNewsletter->Name;
$mail->msgHTML($layout->HtmlText);
if ($mail->send()) {
$person->Status = 1;
$person->save();
} else {
$person->Status = 5;
$person->save();
echo "Mailer Error: " . $mail->ErrorInfo;
}
}
if (empty($lista)) {
$checkNewsletter->Status = 0;
$checkNewsletter->save();
}
}
die;
}
示例13: send
public static function send($to_email, $reply_email, $reply_name, $from_email, $from_name, $subject, $body, $attachments = array())
{
if (Configuration::model()->emailer->relay == 'SMTP') {
$email = new \PHPMailer();
//$email->SMTPDebug = 4;
$email->isSMTP();
$email->Host = Configuration::model()->emailer->host;
$email->SMTPAuth = Configuration::model()->emailer->auth;
$email->Username = Configuration::model()->emailer->username;
$email->Password = Configuration::model()->emailer->password;
$email->SMTPSecure = Configuration::model()->emailer->security;
$email->Port = Configuration::model()->emailer->port;
}
$email->addAddress($to_email);
$email->addReplyTo($reply_email, $reply_name);
$email->setFrom($from_email, $from_name);
$email->Subject = $subject;
$email->Body = $body;
$email->msgHTML($body);
$email->AltBody = strip_tags(str_replace('<br>', "\n\r", $body));
if (is_array($attachments)) {
foreach ($attachments as $value) {
$email->addAttachment($value);
}
}
$email->send();
}
示例14: EnviaCorreo_ClavesAlta
function EnviaCorreo_ClavesAlta($strEmail, $strUsuario, $strPassword)
{
require '../general/phpmailer/PHPMailerAutoload.php';
$from = 'soporte@qualidad.com';
$mail = new PHPMailer();
//Correo desde donde se envía (from)
$mail->setFrom($from, '');
//Correo de envío (to)
$mail->addAddress($strEmail, '');
$mail->CharSet = "UTF-8";
$mail->Subject = 'Sistema de Calidad. Envío de claves';
$strHTML = '<table width="440" border="0" height="22" class="txtgeneral">';
$strHTML = $strHTML . '<tr><td>Sus datos de acceso son:</td></tr>';
$strHTML = $strHTML . "<tr><td>Usuario: <strong>{$strUsuario}<strong></td></tr>";
$strHTML = $strHTML . "<tr><td>Contraseña: <strong>{$strPassword}<strong><br/><br/><br/><br/></td></tr>";
$strHTML = $strHTML . '<tr><td>Agradecemos su colaboración. </td></tr>';
$strHTML = $strHTML . '<tr><td>Atentamente,</td></tr><br><br>';
$strHTML = $strHTML . '<tr><td>Departamento de Calidad</td></tr>';
$strHTML = $strHTML . '<tr><td><center><IMG SRC="http://www.qualidad.info/qualidad/images/logo-' . $_SESSION['base'] . '.jpg" width="132" height="67" BORDER="0"></center>';
$strHTML = $strHTML . '</td></tr>';
$strHTML = $strHTML . '</table>';
$strHTML = '<HTML><BODY><font face=""Verdana, Arial, Helvetica, sans-serif"" size=""-1""><meta http-equiv="Content-type" content="text/html; charset=utf-8" />' . $strHTML . '</font></BODY></HTML>';
$mail->msgHTML($strHTML);
$mail->send();
}
示例15: sendMail
function sendMail($nomeDestino, $emailDestino, $nomeRemetente, $emailRemetente, $assunto, $msg, $arquivo = "")
{
require_once str_replace("admin/", "", DIR) . "system/PHPMailer/PHPMailer.php";
#$nomeDestino = Nome de quem vai receber
#$emailDestino = E-mail de quem vai receber
#$nomeRemetente = Nome de quem está enviando
#$emailRemetente = E-mail de quem está enviando
#$assunto = Assunto do e-mail
#$msg = Mensagem do e-mail
$montaMsg = '<div style="text-align: left"><img src="' . str_replace("admin", "", CP) . '/assets/img/header_mail.jpg" alt="Header" /></div>';
$montaMsg .= '<br /><div style="font-family: Arial; color: #666; font-size: 14px;">' . $msg . '<br /><br />';
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->Debugoutput = 'html';
$mail->Host = getSys("smtpHost");
$mail->Port = getSys("smtpPort");
$mail->SMTPAuth = true;
$mail->Username = getSys("smtpLogin");
$mail->Password = getSys("smtpPass");
$mail->SetFrom(getSys("smtpLogin"), $nomeRemetente);
$mail->addReplyTo($emailRemetente, $nomeRemetente);
$mail->AddAddress($emailDestino, $nomeDestino);
$mail->Subject = $assunto;
$mail->msgHTML($montaMsg);
if ($arquivo == true) {
$mail->AddAttachment($arquivo);
}
if (!$mail->send()) {
return false;
} else {
return true;
}
}