邮件格式与适当的休息时间 [英] mail formatting with propre breaks

查看:135
本文介绍了邮件格式与适当的休息时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要从我的项目中发送邮件.我可以从我的项目中发送邮件,但是邮件内容未格式化.到达目的地后,邮件中的所有新行都会被删除.为什么这样做,请帮忙.

问候,
Shefeek

Hi all,

I need to sent mail from my project.I can sent mail from my project but the mail content is not formatted.All new lines are eliminated from the mail when it reaches the destination.Why it comes so please help.

Regards,
Shefeek

推荐答案

如果您的身体包含常规"换行符("\ n"或Environment.Newline),并且您将电子邮件设置为发送为HTML"换行符将被忽略-相反,它们必须为< br/>.
一种方法是替换它们:
If your body contains "normal" line breaks ("\n" or Environment.Newline) and you have your email set as "Send as HTML" then the newlines will be ignored - they need to be "<br /> instead.
One way to do this is to replace them:
string body = "hello\nthere\nthis\nis\text\n";
body = body.Replace("\n", "<br />");


sir;
我认为您应该将属性HTMLBody设置为true,并将主体设置为html字符串.
sir;
I think you should set the property HTMLBody to true and you set the body to an html string.


这篇关于邮件格式与适当的休息时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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