如何在ASP.NET中的message.body中加粗内容 [英] How to bold content in message.body in ASP.NET

查看:78
本文介绍了如何在ASP.NET中的message.body中加粗内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

StringBuilder mailbody = new StringBuilder();

//message.Body.BodyFormat = message.Body.Html;

System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();

string email = strEmail.ToString()。Substring(1,strEmail.ToString()。Length - 1);

string [] emailList = email.Split(',');

for(int j = 0; j< emailList.Length; j ++)

{

message.To.Add(new System.Net.Mail.MailAddress(emailList [j]));



message.Subject =Appointment理事会的检查员;

message.Body = StrInspector +,+ city +,+ StrMobile +\ n这是确认邮件,根据您的被指定进行检查

+Telephonic Di之后的availity scussion.\\\
.n+

检查的详情如下:-\ n+

课程: - + insptype +\ n+

目的: - + subinsptype +\ n+

席位: - + toSeat +\ n+

城市: - + city +\ n +

州: - +州+\ n+

日期: - + FormDate +To+ ToDate +\ n \ n+

您将收到DCI的正式信函,其中包括有关要检查的学院的所有详细信息。+

在通过邮件进行检查的一天之前\\
$ b / b印度牙医委员会已聘请M / s Balmer Lawrie &上午磷;有限公司,政府 \ n+

印度授权旅行合作伙伴预订机票,酒店住宿 \ n+

并在进行DCI检查时为所有检查员/访客提供出租车。 \ n+

因此,所述旅行合作伙伴将就您的旅行计划与您联系,并 \ n+

相应地进行旅行安排。如有任何疑问和澄清您可以 \ n+

联系旅行合作伙伴代表Mr.Omprakash,电话:9899604205,011 - \ n+

42524112或电子邮件:prakash.o@balmerlawrie.com& ridhi.s@vacationsexotica.com \ n \ n+

<现在,您需要完成上述检查的准备工作。案例\ n +

<任何您可以联系我们的查询:联系No.011-23236544& 9818189120和E-mail us \ n+

< at:inspection@dciindia.org\\\
\ n+

请通过电子邮件立即确认接收 \ n+

在inspections@dciindia.org上回复。 \ nn \\ nn +

感谢你们+

秘书\ n+

印度牙医理事会\\ n+

新德里\ n \\ n+

复制到: \ n+

Mr.Omprakash和Mr.Ridhi,M / s.Balmer Lawrie&有限公司赞助 \ n+

问题。;







}

message.IsBodyHtml = false;

MailAddress fromAddress = new MailAddress(xxxxx ,xxx);

message.From = fromAddress;

//添加新

MailAddress copy = new MailAddress(xxxxxxx。 com);

message.CC.Add(copy);

//结束

SmtpClient smtp = new SmtpClient();

smtp.Host =mail.dciindia.org;

//smtp.EnableSsl = true;

NetworkCredential credential = new NetworkCredential(ixxxxxx ,xxxxxx);

smtp.Credentials =凭证;

smtp.Port = 26;

smtp.Send(消息);



我尝试过: < br $>


以上是我的代码,我想知道如何在邮件正文中加粗大小我尝试使用







for Bold但它不起作用帮助我

StringBuilder mailbody = new StringBuilder();
//message.Body.BodyFormat = message.Body.Html;
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
string email = strEmail.ToString().Substring(1, strEmail.ToString().Length - 1);
string[] emailList = email.Split(',');
for (int j = 0; j < emailList.Length; j++)
{
message.To.Add(new System.Net.Mail.MailAddress(emailList[j]));

message.Subject = "Appointment of Council's Inspectors";
message.Body = StrInspector + "," + city + "," + StrMobile + " \n This is Confirmation mail that You have been appointed for inspection as per Your "
+ "availity after Telephonic Discussion.\n\n" +
"Particulars for the inspection to be held as under:-\n" +
" Course:-" + insptype + "\n" +
" Purpose:-" + subinsptype + "\n" +
" Seats:-" + toSeat + "\n" +
" City:-" + city + "\n" +
" State:-" + State + "\n" +
" Date:-" + FormDate + "To" + ToDate + "\n \n" +
"You will get a Formal Letter from DCI including all details about the College to be inspected\n" +
"before one day to inspection to be held through mail\n\n" +
" The Dental Council of India has engaged M/s Balmer Lawrie & Co.Ltd., a Govt.of \n" +
" India authorized travel partner to make bookings of air-tickets,hotel accommodation \n" +
" and taxi for all the inspectors/Visitors of the Council while going on DCI inspection. \n" +
" Therefore the said travel partner will contact you regarding your travel plan and will \n" +
" make travel arrangements accordingly.in case of any query and clarification you may \n" +
"contact the travel partner's representative Mr.Omprakash at 9899604205,011- \n" +
"42524112 or E-mail:prakash.o@balmerlawrie.com & ridhi.s@vacationsexotica.com\n\n" +
"<Now, you are requested to complete your preparation for the aforesaid inspection.in case\n" +
"<of any query you may contact us: Contact No.011-23236544 & 9818189120 and E-mail us\n" +
"<at:inspection@dciindia.org\n\n" +
"Please acknowledge the receiving immediately by E-mail\n" +
"reply on inspections@dciindia.org.\n\n\n" +
"Thanking You\n\n" +
"Secretary\n" +
"Dental Council of India\n" +
"New Delhi\n\n" +
"Copy to:\n" +
"Mr.Omprakash and Ms.RidM/s.Balmer Lawrie & Co.Ltd.for furtherance in the\n" +
"matter.";



}
message.IsBodyHtml = false;
MailAddress fromAddress = new MailAddress("xxxxx", "xxx");
message.From = fromAddress;
//added New
MailAddress copy = new MailAddress("xxxxxxx.com");
message.CC.Add(copy);
//End
SmtpClient smtp = new SmtpClient();
smtp.Host = "mail.dciindia.org";
//smtp.EnableSsl = true;
NetworkCredential credential = new NetworkCredential("ixxxxxx", "xxxxxx");
smtp.Credentials = credential;
smtp.Port = 26;
smtp.Send(message);

What I have tried:

above is my code and i want to know how to bold size in mail body i am try to use




for Bold but it is not working so kindly help me

推荐答案

如评论中所述,你因为你设置了IsBodyHtml = false,所以不能加粗它。将其更改为true,以便您可以发送HTML。然后使用html粗体标签< b> Bolded Text< / b>
As mentioned in comments, you cannot bold it because you have set IsBodyHtml=false. Change it to be true so that you can send HTML. Then use html bold tags <b>Bolded Text</b>


可以添加

< b>< / b>

这将是粗体

示例





< strong>< / strong>



示例

这是其他类型的粗体



两者都有相同的效果可以使用任何人
can add
<b></b>
This will be bold
example

or
<strong></strong>

example
THis is other type of bold

both have same effects can use anyone


这篇关于如何在ASP.NET中的message.body中加粗内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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