读书人

asp.net 发送邮件 格式 设置有关问题!

发布时间: 2012-01-19 20:57:59 作者: rapoo

asp.net 发送邮件 格式 设置问题!!! 新手 求助!!!
mailMsg.Body 里面怎么 换行,空格啊 ,现在都是 一个字 连 一个字....

请教大家 !!!!!

public partial class TelShoptoFriend : System.Web.UI.Page
{

public static DataRow ShopDetail;

public void Page_Load(object sender, EventArgs e)
{
LoginButton.Attributes.Add( "onClick ", "return checkform(); ");
if(Request.QueryString[ "ShopId "]!=null)
{
if(!IsPostBack)
{
ShopDetail=ShopDetails.GetShopInfo(Convert.ToInt32(Request.QueryString[ "ShopId "]));
shopname1.DataBind();
}
}
}

public void Login_Click(object sender, EventArgs e)
{
MailMessage mailMsg = new MailMessage();

mailMsg.BodyFormat=MailFormat.Html;

mailMsg.From = "******* ";

mailMsg.Subject = Username1.Text+ "推荐: "+ShopDetail[ "Name "].ToString();

mailMsg.Body = "Hi,还好吗? "+messContent1.Text+ "我现在经常上yyhou.com浏览和评论本地的商家(美发厅,美容院,餐馆,特色店等等),分享自己喜欢的商品,还认识了一群朋友呢!你可能也会感兴趣哦! "+ShopDetail[ "Name "];

mailMsg.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ", "1 ");

mailMsg.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername ", "****** ");

mailMsg.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword ", "****** ");

SmtpMail.SmtpServer = "******** ";

if(UserEmail1.Text!= " ")
{
mailMsg.To=UserEmail1.Text.Trim();
SmtpMail.Send(mailMsg);
Response.Write( " <script language= 'javascript '> alert( '发送成功!祝您和您的朋友在yyhou愉快! ') </script> ");


}
}

}

[解决办法]
mailMsg.Body = "我要换行 <br> 换行了 "
[解决办法]
你想让哪换行??
你可以试试


mailMsg.Body = "我要换行\r\n换行了 "
应该就可以了。

读书人网 >asp.net

热点推荐