在电子邮件正文中发送内容 [英] Sending content in body of email

查看:119
本文介绍了在电子邮件正文中发送内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个要求,我必须以下列格式发送电子邮件正文中的内容:



S1

Column1 Column2 Column3 Column4 Column5

Value1 VAlue2 VAlue3 VAlue4 Value5



S2

Column1 Column2 Column3 Column4 Column5

Value1 VAlue2 VAlue3 VAlue4 Value5





Value2和Value3的长度可变,因此正文中的内容呈Z字形格式。



你能帮忙吗?





谢谢和问候,

Ankur Agarwal。

Hi,

I have a requirement where I have to send the content in the body of the email in the following format:

S1
Column1 Column2 Column3 Column4 Column5
Value1 VAlue2 VAlue3 VAlue4 Value5

S2
Column1 Column2 Column3 Column4 Column5
Value1 VAlue2 VAlue3 VAlue4 Value5


Value2 and Value3 are of variable length hence the content in the body are coming in zigzag format.

Can you please help?


Thanks and Regards,
Ankur Agarwal.

推荐答案

set MailMessage.IsBodyHtml true 然后您可以构建HTML正文并发送。



您可以为S1和S2内容使用两个HTML表格。然后在构建完整的html后,将其设置为 Body MailMessage



示例代码 [ ^ ]
set the MailMessage.IsBodyHtml as true then you can build HTML body and send.

You can use two HTML tables for your S1 and S2 contents. then after you build full html, set it as Body of the MailMessage

Sample code[^]


除了解决方案1:请参阅我对此解决方案的评论。< br $> b $ b

请参阅:

http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.isbodyhtml%28v=vs.110% 29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/System.Net.Mail.MailMessage%28v=vs.110%29.aspx [ ^ ],

http:/ /msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.bodyencoding%28v=vs.110%29.aspx [ ^ ]。



关于内容类型: http://en.wikipedia.org/wiki/Internet_media_type [ ^ ]。



内容类型由IANA标准化和维护:

http://www.iana.org/assignments/media-types/ [ ^ ],

另见: http://en.wikipedia.org/wiki/Internet_Assigned_Numbers_Authority [ ^ ]。



-SA
In addition to Solution 1: please see my comment to this solution.

Please see:
http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.isbodyhtml%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/System.Net.Mail.MailMessage%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.bodyencoding%28v=vs.110%29.aspx[^].

About content types: http://en.wikipedia.org/wiki/Internet_media_type[^].

Content types are standardized and maintained by IANA here:
http://www.iana.org/assignments/media-types/[^],
see also: http://en.wikipedia.org/wiki/Internet_Assigned_Numbers_Authority[^].

—SA


这篇关于在电子邮件正文中发送内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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