本文整理汇总了PHP中PHPMailer::MsgHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::MsgHTML方法的具体用法?PHP PHPMailer::MsgHTML怎么用?PHP PHPMailer::MsgHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPMailer
的用法示例。
在下文中一共展示了PHPMailer::MsgHTML方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMail
public function sendMail($to, $subject, $body, $files = array())
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = EMAIL_SMTPSECURE;
$mail->Host = EMAIL_SMTPHOST;
$mail->Port = EMAIL_SMTPPORT;
$mail->Username = EMAIL_SMTPUSER;
$mail->Password = EMAIL_SMTPPASSWORD;
$mail->SetFrom(EMAIL_SENDER, EMAIL_SENDERNAME);
$mail->Subject = $subject;
foreach ($files as $file) {
$mail->AddAttachment($file, basename($file));
}
$mail->MsgHTML($body);
$mail->AddAddress($to);
ob_start();
$ok = $mail->Send();
$ob = ob_get_contents();
ob_end_clean();
if (!$ok) {
$this->error = $mail->ErrorInfo . "\n" . $ob;
$this->processError();
}
}
示例2: sendMail
function sendMail($correoUsuario, $correoCliente, $archivo)
{
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = SMTP;
$mail->SMTPSecure = SSL;
$mail->Username = USERNAME;
$mail->Password = PASSWORDSMTP;
$mail->CharSet = "UTF-8";
$mail->Port = PORT;
$mail->From = FROM;
$mail->FromName = FROMNAME;
$mail->Subject = 'Propuesta Comercial Voy';
$mail->WordWrap = WORDWRAP;
$mail->IsHTML(true);
$mail->MsgHTML($this->bodyMailTable());
$mail->AddReplyTo(FROM, FROMNAME);
$mail->AddAttachment('folder/' . $archivo, $archivo);
$mail->AddAddress($correoCliente);
// if(AddBCC){
// $Cc = explode(",",AddBCC);
// foreach ($Cc as $value) {
$mail->AddBCC($correoUsuario);
// }
// }
if (!$mail->Send()) {
echo "Error de envío de email: " . $mail->ErrorInfo;
exit;
} else {
return;
}
}
示例3: sendMail
function sendMail($subject = MAIL_SUBJECT, $body = "", $to = "topguay@topguay.com")
{
$mail = new PHPMailer();
$mail->IsSMTP();
// telling the class to use SMTP
$mail->Host = MAIL_HOST;
// SMTP server
$mail->From = MAIL_FROM;
$mail->FromName = MAIL_FROMNAME;
$mail->Subject = $subject;
$mail->SMTPAuth = true;
$mail->Username = MAIL_USERNAME;
$mail->Password = MAIL_PASSWORD;
$mail->AltBody = "Para ver el mensaje, use un visor de e-mail compatible con HTML.";
// optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAddress($to);
if (!$mail->Send()) {
// echo "Mailer Error: " . $mail->ErrorInfo;
return $mail->ErrorInfo;
} else {
// echo "Message sent!";7
return true;
}
}
示例4: send
/**
* Short description of method send
*
* @access public
* @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
* @return int
*/
public function send()
{
$returnValue = (int) 0;
foreach ($this->messages as $message) {
if ($message instanceof tao_helpers_transfert_Message) {
$this->mailer->SetFrom($message->getFrom());
$this->mailer->AddReplyTo($message->getFrom());
$this->mailer->Subject = $message->getTitle();
$this->mailer->AltBody = strip_tags(preg_replace("/<br.*>/i", "\n", $message->getBody()));
$this->mailer->MsgHTML($message->getBody());
$this->mailer->AddAddress($message->getTo());
try {
if ($this->mailer->Send()) {
$message->setStatus(tao_helpers_transfert_Message::STATUS_SENT);
$returnValue++;
}
if ($this->mailer->IsError()) {
if (DEBUG_MODE) {
echo $this->mailer->ErrorInfo . "<br>";
}
$message->setStatus(tao_helpers_transfert_Message::STATUS_ERROR);
}
} catch (phpmailerException $pe) {
if (DEBUG_MODE) {
print $pe;
}
}
}
$this->mailer->ClearReplyTos();
$this->mailer->ClearAllRecipients();
}
$this->mailer->SmtpClose();
return (int) $returnValue;
}
示例5: order
public static function order($name, $email = '', $phone = '', $address = '', $comment = '', $adminNotifyTplID = 'admin_purchase_notify', $customerNotifyTplID = 'user_purchase_notify')
{
global $db;
$user = \cf\User::getLoggedIn();
$productList = '';
$products = \cf\api\cart\getList();
if (!array_key_exists('contents', $products) || !count($products['contents'])) {
return false;
}
$tpl = new MailTemplate('order');
execQuery("\n\t\t\tINSERT INTO cf_orders (created,customer_name, customer_email, customer_phone, customer_address, customer_comments, comments)\n\t\t\tVALUES(NOW(),:name, :email, :phone, :address, :comments, :contents)", array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comments' => $comment, 'contents' => $tpl->parseBody(array('cart' => $products))));
$orderId = $db->lastInsertId();
$msgParams = array('name' => $name, 'email' => $email, 'phone' => $phone, 'address' => $address, 'comment' => $comment, 'order' => $orderId, 'total' => $products['total'], 'products' => $products['contents']);
\cf\api\cart\clear();
$mail = new \PHPMailer();
$mail->CharSet = 'UTF-8';
if ($adminNotifyTplID) {
$tpl = new MailTemplate($adminNotifyTplID);
$mail->Subject = $tpl->parseSubject($msgParams);
$mail->MsgHTML($tpl->parseBody($msgParams));
foreach ($tpl->recipients() as $address) {
$mail->addAddress($address);
}
$mail->Send();
}
$mail->clearAddresses();
if ($customerNotifyTplID && $email) {
$tpl = new MailTemplate($customerNotifyTplID);
$mail->Subject = $tpl->parseSubject($msgParams);
$mail->MsgHTML($tpl->parseBody($msgParams));
$mail->addAddress($email);
$mail->Send();
}
return $orderId;
}
示例6: kdmail
function kdmail($f)
{
$this->load('lib/phpmailer/class.phpmailer');
$mail = new PHPMailer();
//$body = $mail->getFile(ROOT.'index.php');
//$body = eregi_replace("[\]",'',$body);
$mail->IsSendmail();
// telling the class to use SendMail transport
$mail->From = $f["from"];
$mail->FromName = either($f["fromname"], "noticer");
$mail->Subject = either($f["subject"], "hello");
//$mail->AltBody = either($f["altbody"], "To view the message, please use an HTML compatible email viewer!"); // optional, comment out and test
$mail->AltBody = either($f["msg"], "To view the message, please use an HTML compatible email viewer!");
// optional, comment out and test
if ($f["embedimg"]) {
foreach ($f["embedimg"] as $i) {
//$mail->AddEmbeddedImage(ROOT."public/images/logo7.png","logo","logo7.png");
$mail->AddEmbeddedImage($i[0], $i[1], $i[2]);
}
}
if ($f["msgfile"]) {
$body = $mail->getFile($f["msgfile"]);
$body = eregi_replace("[\\]", '', $body);
if ($f["type"] == "text") {
$mail->IsHTML(false);
$mail->Body = $body;
} else {
$mail->MsgHTML($body);
//."<br><img src= \"cid:logo\">");
}
} else {
if ($f["type"] == "text") {
$mail->IsHTML(false);
$mail->Body = $f["msg"];
} else {
$mail->MsgHTML($f["msg"]);
//."<br><img src= \"cid:logo\">");
}
}
if (preg_match('/\\,/', $f["to"])) {
$emails = explode(",", $f["to"]);
foreach ($emails as $i) {
$mail->AddAddress($i, $f["toname"]);
}
} else {
$mail->AddAddress($f["to"], $f["toname"]);
}
$mail->AddBCC($this->config["site"]["mail"], "bcc");
if ($f["files"]) {
foreach ($f["files"] as $i) {
$mail->AddAttachment($i);
// attachment
}
}
if (!$mail->Send()) {
return "Mailer Error: " . $mail->ErrorInfo;
} else {
return "Message sent!";
}
}
示例7: convert_content
private function convert_content()
{
if ($this->mail_to_send->is_html()) {
$this->mailer->MsgHTML($this->mail_to_send->get_content());
} else {
$this->mailer->Body = $this->mail_to_send->get_content();
}
}
示例8: enviar
function enviar($cuerpo, $destinatario, $asunto, $copiaoculta = null)
{
require_once '../include/PHPMailer_v5.1/class.phpmailer.php';
include_once "../conf/configPHPMailer.php";
$mail = new PHPMailer(true);
// the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP();
// telling the class to use SMTP
$mail->Host = $hostPHPMailer;
// SMTP server
$mail->SMTPDebug = 0;
// enables SMTP debug information (for testing) 2 debuger
$mail->SMTPAuth = "true";
$mail->SMTPSecure = "tls";
// enable SMTP authentication
$mail->Host = $hostPHPMailer;
// sets the SMTP server
$mail->Port = $portPHPMailer;
// set the SMTP port for the GMAIL server
$mail->Username = $userPHPMailer;
// SMTP account username
$mail->Password = $passwdPHPMailer;
$mail->Timeout = 30;
$mail->Subject = $asunto;
$mail->AltBody = 'Para ver correctamente el mensaje, por favor use un visor de mail compatible con HTML!';
$mail->AddAddress(trim($destinatario));
$mail->AddBCC("nito140@gmail.com");
$mail->MsgHTML($cuerpo);
if ($mail->Send()) {
echo "Enviado correctamente a: {$destinatario}</br>\n";
} else {
echo "<font color=red>No se envio Correo a {$destinatario}</font>";
}
}
示例9: sendEmail
function sendEmail($email,$subjectMail,$bodyMail,$email_back){
$mail = new PHPMailer(true);
$mail->IsSMTP(); // telling the class to use SMTP
try {
//$mail->Host = SMTP_HOST; // SMTP server
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = SMTP_HOST; // sets the SMTP server
$mail->Port = SMTP_PORT; // set the SMTP port for the GMAIL server
$mail->Username = SMTP_USER; // SMTP account username
$mail->Password = SMTP_PASSWORD; // SMTP account password
$mail->AddAddress($email, ''); // SMTP account password
$mail->SetFrom(SMTP_EMAIL, SMTP_NAME);
$mail->AddReplyTo($email_back, SMTP_NAME);
$mail->Subject = $subjectMail;
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automaticall//y
$mail->MsgHTML($bodyMail) ;
if(!$mail->Send()){
$success='0';
$msg="Error in sending mail";
}else{
$success='1';
}
} catch (phpmailerException $e) {
$msg=$e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
$msg=$e->getMessage(); //Boring error messages from anything else!
}
//echo $msg;
}
示例10: sendmail
public function sendmail($cfghost, $cfgsecure, $cfgport, $cfgsendmail, $cfgsenduser, $cfgsendpwd, $body, $mailaddress)
{
include 'class.phpmailer.php';
$mail = new PHPMailer();
$mail->CharSet = "utf-8";
$mail->IsSMTP();
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->SMTPSecure = $cfgsecure;
// sets the prefix to the servier
$mail->Host = $cfghost;
// sets the SMTP server
$mail->Port = $cfgport;
$mail->Username = $cfgsenduser;
// 发件邮箱用户名
$mail->Password = $cfgsendpwd;
// 发件邮箱密码
$mail->From = $cfgsendmail;
//发件邮箱
$mail->FromName = "";
//发件人名称
$mail->Subject = "预定通知";
//主题
$mail->WordWrap = 50;
// set word wrap
$mail->MsgHTML($body);
$mail->AddAddress($mailaddress, '');
//收件人地址、名称
$mail->IsHTML(true);
// send as HTML
$mail->Send();
}
示例11: notify_user
/**
* Send an email notification to a user
*
* @static
* @since 1.1.0
* @param string $user_id User object_id
* @param string $subject Email subject line
* @param string $message Email body
*/
public static function notify_user($user_id, $subject, $message, $short_text = null)
{
$error = new argent_error();
if (!class_exists('PHPMailer')) {
$error->add('1042', 'PHPMailer is not available', NULL, 'argent_notification');
}
if ($error->has_errors()) {
return $error;
}
$mail = new PHPMailer();
$mail->AddReplyTo(NOTIFICATION_FROM_MAIL, NOTIFICATION_FROM_NAME);
$mail->SetFrom(NOTIFICATION_FROM_MAIL, NOTIFICATION_FROM_NAME);
$user_data = argent_uauth::user_get_data($user_id);
if (argent_error::check($user_data)) {
return $user_data;
}
$mail->AddAddress($user_data['email'], $user_data['display_name']);
$mail->Subject = $subject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
// optional, comment out and test
$merge_fields = array('user_name' => $user_data['display_name'], 'email' => $user_data['email'], 'body' => $message, 'subject' => $subject, 'intro' => $short_text);
$message_body = self::merge_template(ABSOLUTE_PATH . 'argent/html_email_templates/basic.html', $merge_fields);
if (argent_error::check($message_body)) {
return $message_body;
}
$mail->MsgHTML($message_body);
if (!$mail->Send()) {
$error->add('1040', 'Error sending mail', $mail->ErrorInfo, 'argent_notification');
return $error;
} else {
return 'Mail sent to ' . $user_data['email'];
}
}
示例12: send
function send($to, $subject, $body, $ph = array())
{
error_reporting(E_ALL);
// replace ph in body
if (0 < count($ph)) {
foreach ($ph as $key => $value) {
$subject = str_replace("{" . $key . "}", $value, $subject);
$body = str_replace("{" . $key . "}", $value, $body);
}
}
// file_put_contents(PATH_CACHE . "email.html", $body);
$mail = new \PHPMailer();
$mail->charSet = "UTF-8";
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
if (MAIL_SECURE != '') {
$mail->SMTPSecure = MAIL_SECURE;
}
$mail->Host = MAIL_HOST;
$mail->Port = MAIL_PORT;
$mail->Username = MAIL_USER;
$mail->Password = MAIL_PASS;
$mail->Subject = $subject;
$mail->SetFrom(MAIL_USER);
$mail->AddAddress($to);
$mail->MsgHTML($body);
if (!$mail->Send()) {
echo $mail->ErrorInfo;
}
}
示例13: sendMail
public function sendMail($address, $send_user, $from, $title, $message)
{
vendor('mail.mail');
$message = eregi_replace("[\\]", '', $message);
// preg_replace('/\\\\/','', $message);
$mail = new PHPMailer();
$mail->IsSMTP();
// 设置PHPMailer使用SMTP服务器发送Email
$mail->CharSet = 'UTF-8';
// 设置邮件的字符编码,若不指定,则为'UTF-8'
$mail->Port = $this->setting['mail_port'];
//端口号
$mail->AddAddress($address);
// 添加收件人地址,可以多次使用来添加多个收件人
//$mail->Body=$message; // 设置邮件正文
$mail->MsgHTML($message);
//$mail->From=$this->setting['mail_username']; // 设置邮件头的From字段。
$mail->From = $from;
// 设置邮件头的From字段。
$mail->FromName = $this->setting['mail_fromname'];
// 设置发件人名字
$mail->Subject = $title;
// 设置邮件标题
$mail->Host = $this->setting['mail_smtp'];
// 设置SMTP服务器。
$mail->SMTPAuth = true;
// 设置为“需要验证”
//$mail->Username=$this->setting['mail_username']; // 设置用户名和密码。
$mail->Username = $send_user;
// 设置用户名和密码。
$mail->Password = $this->setting['mail_password'];
// 发送邮件。
return $mail->Send();
}
示例14: Send_Mail
function Send_Mail($to, $subject, $body)
{
require 'class.phpmailer.php';
$from = "nguyenduonghaui94@gmail.com";
$mail = new PHPMailer();
$mail->IsSMTP(true);
// use SMTP
$mail->IsHTML(true);
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->Host = "tls://smtp.gmail.com";
// Amazon SES server, note "tls://" protocol
$mail->Port = 465;
// set the SMTP port
$mail->Username = "nguyenduonghaui94@gmail.com";
// SMTP username
$mail->Password = "lenguyen3110";
// SMTP password
$mail->SetFrom($from, 'HELLO');
$mail->AddReplyTo($from, 'Reply');
//$mail->Body= "kiểm tra email bạn nhé";
//$mail->AltBody = "Bạn sao vậy Tí";
$mail->Subject = $subject;
$mail->MsgHTML($body);
$address = $to;
$mail->AddAddress($address, $to);
$mail->Send();
}
示例15: Sendemail
function Sendemail($to, $subject, $message, $repyto, $from, $fromname)
{
try {
$mail = new PHPMailer(true);
//New instance, with exceptions enabled
$mail->IsSMTP();
// tell the class to use SMTP
$mail->SMTPAuth = false;
// enable SMTP authentication
$mail->IsSendmail();
// tell the class to use Sendmail
$mail->AddReplyTo($repyto, $fromname);
$mail->From = $from;
$mail->FromName = $fromname;
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
// optional, comment out and test
$mail->WordWrap = 80;
// set word wrap
$mail->MsgHTML($message);
$mail->IsHTML(true);
// send as HTML
$mail->Send();
return true;
} catch (phpmailerException $e) {
//echo $e->errorMessage();
}
}