Click here to Skip to main content
12,063,909 members (64,381 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# email
Hello,
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.

Rohit
Posted 27-Dec-12 18:39pm
Rate this: bad
 
good
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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

string v_sendMailUserName = "userName";//
string v_sendMailPassword = "userPwd";//
string v_sendMailAddress ="xx@xx.com";//
string v_receiveMailAddress ="xx@xx.com";//
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.To.Add(v_receiveMailAddress);

mes.Subject = v_mailSubject;
mes.Body = @"<html>

this is test!<img url="xx.jpg">

</img>

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

Solution 3

  Permalink  

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.160204.4 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2016
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