How to send web page in email body with css
Solution 1
Take a look to this chart :
http://www.campaignmonitor.com/css/
I would recommend you to use inline styles instead of adding an external css sheet
Solution 2
styling html emails is a pain in the ass, with each client (gmail/hotmail/outlook/yahoo) applying their own styles to certain high level elements.
a good rule of thumb is to apply inline styles for example:
<span style="display:block; background:red;">blah</span>
have a look at campaign monitor to see which css rules work and litmus if you wish to take the pain out of the testing
Dov Miller
Updated on June 04, 2022Comments
-
Dov Miller almost 2 years
I am creating a report on an asp.net web page using an html table and asp.net lables. The finished report I have to send by email in the message body. I've done this with the following c# code:
public bool SendEMail(List<string> emailList, string strSubject, string strMessage, bool isHTML) { MailMessage msg = new MailMessage(); msg.From = new MailAddress(strFrom); //emailList is a list of email addresses to be sent to if (emailList != null && emailList.Count > 0) foreach (string em in emailList) { msg.To.Add(em); } else return false; msg.Subject = strSubject; msg.Body = strMessage; msg.IsBodyHtml = isHTML; SmtpClient smtp = new SmtpClient(mailServer); smtp.Credentials = new System.Net.NetworkCredential(userName, usePass); smtp.Send(msg); msg.Dispose(); return true; }
This works well but it only gets styles set within the form itself on each control individually. How can I incorperate css set in the html head or in a style sheet? Also is it possible to include skins?