PHPmailer发送HTML代码 [英] PHPmailer sending HTML CODE
本文介绍了PHPmailer发送HTML代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用PHPmailer发送电子邮件.
I am using PHPmailer to send email.
我还使用了HTML = True内容类型
I have also used HTML = True content type
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = $Host;
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = $Username;
$mail->Password = $Password;
$mail->From = $From;
$mail->FromName = $FromName;
$mail->AddAddress($To , $ToName);
$mail->WordWrap = 50; // set word wrap
$mail->Priority = 1;
$mail->IsHTML(true);
$mail->Subject = $Subject;
$mail->Body = $Body;
发送电子邮件后,我会看到实际的HTML代码而不是内容,请在下面检查
Once the email is sent i see the actual HTML code instead of the contents please check below
**不确定是什么问题**
**Not sure what is the issue **
推荐答案
在设置实例Body
属性(我的意思是$mail->Body
)后调用isHTML()
方法为我解决了这个问题:
Calling the isHTML()
method after the instance Body
property (I mean $mail->Body
) has been set solved the problem for me:
$mail->Subject = $Subject;
$mail->Body = $Body;
$mail->IsHTML(true); // <=== call IsHTML() after $mail->Body has been set.
这篇关于PHPmailer发送HTML代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文