如何发送网页的电子邮件正文中使用CSS [英] How to send web page in email body with css
问题描述
我创建使用HTML表和asp.net标贴一个asp.net网页上的报告。完成的报告我有电子邮件在邮件正文发送。我曾与下面的C#code做到了这一点:
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;
}
这工作得很好,但它只是变得样式表单中设置的每个单独的控制。我怎样才能incorperate CSS设置在HTML头部或在样式表?
也有可能包括皮肤?
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?
推荐答案
看看这个图:
http://www.campaignmonitor.com/css/
我会建议你使用内联样式,而不是添加外部CSS表
I would recommend you to use inline styles instead of adding an external css sheet
这篇关于如何发送网页的电子邮件正文中使用CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!