简体   繁体   中英

HTML code shown in emails sent

When I am sending a mail via PHP, I am using the PHPMailer class. However when I send the mail and look at it in Outlook I see that sometimes the raw HTML code is displayed. Anyone know why this could be?

在此处输入图片说明

您必须告诉PHPmailer您正在将邮件呈现为HTML。

 $mail->IsHTML(true);

I think it's because of the empty space in the opening of the IMG tag.

< img src"{src}" alt="{alt}" />

should probably be:

<img src="{src}" alt="{alt}" />

< img should changes to <img

You can check this example

在HTML验证工具中测试您的html代码并进行相应修复。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM