Wildone63
asked on
Stringbuilder
Hello,
I am using string builder to create a table that will go into an email.
Basically this works fine but what I want to do is have a table, the the first row spans across several columns.
then the second row would have several columns.
Is there anyway to have a table row span multiple columns using SB?
Thank You.
I am using string builder to create a table that will go into an email.
Basically this works fine but what I want to do is have a table, the the first row spans across several columns.
then the second row would have several columns.
Is there anyway to have a table row span multiple columns using SB?
Thank You.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Another approach is to generate an HtmlTable structure, and then render the control to a StringWriter and an HtmlTextWriter.
private void button1_Click(object sender, EventArgs e)
{
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("your_email_address@gmail.com");
mail.To.Add("to_address");
mail.Subject = "Test Mail - 1";
mail.IsBodyHtml = true;
string htmlBody;
htmlBody = "<table><tr><td colspan="2">2 col</td></tr><tr><td>First Column</td><td>Second Column</td></tr></table>";
mail.Body = htmlBody;
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
MessageBox.Show("mail Send");
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
Ref:http://csharp.net-informations.com/communications/csharp-html-email.htm
Have a look at this one as well:-
http://www.emailarchitect.net/easendmail/kb/csharp.aspx?cat=6;
you can always replace the htmlbody string with stringbuilder.
ASKER
Exactly what I was looking for.
Thank You!
Thank You!