Click here to Skip to main content
15,891,734 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i work in project data from our site to customers
but i need to do something
i don't wan't that data to be send as regaul string
i want it to apperat inside table
i send customers offer price
so i want to be easy to read
some thing like that

Serial ProductName Quantity Price

i want my data to dir in that structure in email sent to customers
Posted

string text= "<table><tr><td>EmpId</td><td>Emp name</td><td>age</td></tr><tr><td>value</td><td>value</td><td>value</td></tr></table>"
MailMessage mail = new MailMessage();
mail.To ="me@mycompany.com;him@hiscompany.com;her@hercompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.IsBodyHtml=true; 
mail.Body = text;
MailAttachment attachment = new MailAttachment( Server.MapPath( "test.txt" ) ); 
mail.Attachments.Add( attachment );	//add the attachment
SmtpMail.SmtpServer = "smtp.gmail.com";  //your real server goes hereSmtpMail.Send( mail );
 
Share this answer
 
Use String Builder in .Net it will Work for You

Like this

Dim str As New StringBuilder
str.Append("<html><head></head><title></title>")
str.Append("<body style='font-size:12px;font-family:Trebuchet MS;'>")
str.Append("<table width='600px' align='center' border='0' cellpadding='0' cellspacing='0' style='border-top:5px solid white;'")
str.Append("<tr><td></tr></td></table>")


We want to Design the table like this from Dt get the records and LOOP it..Write all this like a Sub Funcation and Use in Email Body
 
Share this answer
 
One way is to use a basic html page as email body. Use stream reader to load the html page and replace the static text in the html page with your required data.

or use string builder
StringBuilder sb = new StringBuilder();
sb.Append("<table><tr><td>your content here</td></tr></table>");
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900