发送到Outlook时不保留HTML格式

时间:2019-05-19 12:45:21

标签: c# html email outlook system.net.mail

我正在使用System.Net.Mail发送一封邮件,其中的正文使用其他解决方案中提供的“ IsBodyHtml”标志来包含HMTL字符串。

How to send HTML-formatted email?

MailMessage.IsBodyHtml Propery - Microsoft Docs

这对于将原本会在Outlook中以文本形式显示的内容转换为HTML效果很好,但是格式完全混乱了,Outlook会显示一个标志,指出 ”,如果此消息的方式有问题显示出来,请点击此处在网络浏览器中查看”。

问题:是什么导致Outlook中的格式问题?我需要能够直接在Outlook中以正确的格式发送电子邮件。在下面查看我的HTML标签布局的示例,该示例非常简单:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>TEST</title>

</head>
<body leftmargin="10" topmargin="10" rightMargin="10" bottomMargin="10" style="background-color:#FFFFFF">
<table cellpadding="0" cellspacing="0" border="0" style="border-width:0px;empty-cells:show;width:624px;height:1815px;position:relative;">
<!-- My content would go here which is just a table of text -->
</table>
</body>
</html>

0 个答案:

没有答案
相关问题