邮件正文中的交互式html [英] interactive html inside mail body

查看:148
本文介绍了邮件正文中的交互式html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一封带身体的电子邮件。我希望在邮件正文中嵌入一个html页面,我的html页面将有一些链接和文本框来搜索和导航。



请给我任何建议。



Rohit

Hello,
I have a email with body . i want to have a html page embedded inside the mail body , and my html page will have some links and textbox to search and navigate .

Any suggestions please.

Rohit

推荐答案

您可以将HTML放在邮件正文中,只需将其包装在HTML标记中即可。



但是,你应该知道你可能不会得到它你想要的行为。有许多流行的电子邮件客户端,它们都以不同的方式处理消息。许多人只会将消息显示为文本,并会忽略HTML标记中包含的任何内容。许多显示HTML的内容可能会默认阻止HTML中图像的图像下载(这是一个隐私漏洞)。您可能会发现大多数客户端也会默认阻止任何活动组件(例如闪存),脚本以及可能的POST操作。电子邮件客户端通常(并且理所当然地)不信任电子邮件内容并尝试将其保存在沙箱中。这真的限制了你能做什么,不能做什么。它已被多次用作攻击媒介,没有人信任电子邮件。
You can put HTML inside a message body, just wrap it in HTML tags.

However, you should know that you probably won''t get the behavior you desire. There are a number of popular email clients out there and they all handle messages differently. Many will only display the message as text and will ignore anything wrapped in HTML tags. Many that will display HTML are likely to block image downloads for images in the HTML by default (it is a privacy hole). You are likely to find that most clients will also block any active components by default (such as flash), scripting, and probably POST operations as well. Email clients usually (and rightfully) distrust email content and try to keep it in a sandbox. This really limits what you can and can''t do. It has been used as an attack vector so many times, nobody trusts email any more.


string v_sendMailUserName =userName; //

string v_sendMailPassword = userPwd; //

string v_sendMailAddress =xx@xx.com; //

string v_receiveMailAddress =xx@xx.com; //

string v_mailSubject =; //





SmtpClient smtp = new SmtpClient(v_smtpAddress);

smtp.Credentials = new System.Net.NetworkCredential(v_sendMailUserName,v_sendMailPassword);

MailMessage mes = new MailMessage();



mes.From = new MailAddress(v_sendMailAddress);

mes.To.Add(v_receiveMailAddress);



mes.Subject = v_mailSubject ;

mes.Body = @

这是测试!

string v_sendMailUserName = "userName";//
string v_sendMailPassword = "userPwd";//
string v_sendMailAddress ="xx@xx.com";//
string v_receiveMailAddress ="xx@xx.com";//
string v_mailSubject = "";//


SmtpClient smtp = new SmtpClient(v_smtpAddress);
smtp.Credentials = new System.Net.NetworkCredential(v_sendMailUserName, v_sendMailPassword);
MailMessage mes = new MailMessage();

mes.From = new MailAddress(v_sendMailAddress);
mes.To.Add(v_receiveMailAddress);

mes.Subject = v_mailSubject;
mes.Body = @"

this is test!


以下是一个示例:电子邮件模板 [ ^ ]。

你也可以使用邮件定义类 [ ^ ]制作交互式HTML邮件正文。



如需更多信息,请参阅:

如何使用C#.NET,VB.NET在Asp.Net中作为电子邮件正文发送HTML页面 [ ^ ]

发送ASP.NET 2.0中的电子邮件:HTML格式的电子邮件,附件和优雅处理SMTP例外 [ ^ ]



希望有所帮助。

--Amit
Here is a sample : Email Templates[^].
And also you can use MailDefinition Class[^] to make interactive HTML mail body.

For more referances see:
How to Send HTML Page As Email Body in Asp.Net Using C#.NET,VB.NET[^]
Sending Email in ASP.NET 2.0: HTML-Formatted Emails, Attachments, and Gracefully Handling SMTP Exceptions[^]

Hope it helps.
--Amit


这篇关于邮件正文中的交互式html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆