In my application for sending an Inquiry mail, i have a text box for enter address.. if i type address in the textbox like below
33A, sector -8, /*Pressed enter Key*/
Sanpada, /*Pressed enter Key*/
Navi mumbai.
it should be display in the mail as like
33A, sector -8,
Sanpada,
Navi mumbai.
but it is displaying like
33A, sector -8, Sanpada,Navi mumbai.
my code for sending mail is
string content = "";
string sub = "";
content = File.ReadAllText(Server.MapPath("../mail/MasterJnenquiry.html"));
content = content.Replace("##CustomerCompanyName##", txtCompanyName.Text);
content = content.Replace("##CompanyName##", txtCompanyName.Text);
content = content.Replace("##ContactName##", txtContactname.Text);
content = content.Replace("##ContactNo##", txtContactNo.Text);
content = content.Replace("##EmailId##", txtemailid.Text);
content = content.Replace("##EnquiryMessage##", txtenqmess.Text);
content = content.Replace("##Designation##", txtdesignation.Text);
content = content.Replace("##Address##", txtadress.Text);
content = content.Replace("##ProductDetails##", txtProductdetails.Text);
sub = "お客様のお問い合わせ≪インドの窓口≫";
how to display textbox text in the mail in html format??
i did the following to solve my problem..
string content = "";
string sub = "";
content = File.ReadAllText(Server.MapPath("../mail/MasterJnenquiry.html"));
content = content.Replace("##CustomerCompanyName##", txtCompanyName.Text);
content = content.Replace("##CompanyName##", txtCompanyName.Text);
content = content.Replace("##ContactName##", txtContactname.Text);
content = content.Replace("##ContactNo##", txtContactNo.Text);
content = content.Replace("##EmailId##", txtemailid.Text);
content = content.Replace("##EnquiryMessage##", txtenqmess.Text);
content = content.Replace("##Designation##", txtdesignation.Text);
string addr = Server.HtmlEncode(txtadress.Text);
addr = addr.Replace("\n", "<br/>");
content = content.Replace("##Address##", addr);
content = content.Replace("##ProductDetails##", txtProductdetails.Text);
sub = "お客様のお問い合わせ≪インドの窓口≫";
The change in the code is
string addr = Server.HtmlEncode(txtadress.Text);
addr = addr.Replace("\n", "<br/>");
content = content.Replace("##Address##", addr);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.