Click here to Skip to main content
12,753,089 members (38,324 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# email
I have a email with body . i want to have a html page embedded inside the mail body , and my html page will have some links and textbox to search and navigate .

Any suggestions please.

Posted 27-Dec-12 18:39pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can put HTML inside a message body, just wrap it in HTML tags.

However, you should know that you probably won't get the behavior you desire. There are a number of popular email clients out there and they all handle messages differently. Many will only display the message as text and will ignore anything wrapped in HTML tags. Many that will display HTML are likely to block image downloads for images in the HTML by default (it is a privacy hole). You are likely to find that most clients will also block any active components by default (such as flash), scripting, and probably POST operations as well. Email clients usually (and rightfully) distrust email content and try to keep it in a sandbox. This really limits what you can and can't do. It has been used as an attack vector so many times, nobody trusts email any more.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

string v_sendMailUserName = "userName";//
string v_sendMailPassword = "userPwd";//
string v_sendMailAddress ="";//
string v_receiveMailAddress ="";//
string v_mailSubject = "";//

SmtpClient smtp = new SmtpClient(v_smtpAddress);
smtp.Credentials = new System.Net.NetworkCredential(v_sendMailUserName, v_sendMailPassword);
MailMessage mes = new MailMessage();

mes.From = new MailAddress(v_sendMailAddress);

mes.Subject = v_mailSubject;
mes.Body = @"

this is test!

mes.IsBodyHtml = true;//set html format
Rate this: bad
Please Sign up or sign in to vote.

Solution 3


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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100