0
내 C# 응용 프로그램에서 보내는 전자 메일에 약간의 서식을 추가하려면 다음을 사용하고 있습니다. 그것은 내 모바일 클라이언트 전자 메일 안드로이드 및 ios뿐만 아니라 Outlook 2011 Mac 용 잘 표시하지만 Outlook 2013에서 자체 서식을 가져 오는 오전. 나는 www.campaignmonitor.com/css 쳐다 보면서 Outlook 2013에서 C# System.Net.Mail CSS 오류
<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
table, thead, th, tr, td {
border: 1px solid black;
padding:5px;
border-collapse:collapse;
}
table {
margin-bottom:10px;
}
th {
background:grey;
color:white;
}
tbody tr:nth-child(even) {
background-color: #bada55;
}
tbody tr:nth-child(odd) {
background-color: lightblue;
}
</style>
</head>
<body>
Here are the list of files on <b>CO200197L</b> for date 2014-09-02 that contain(s) <b><i>c</i> </b><br><br>
<table>
<tr>
<th>Filename</th>
</tr>
<tr><td>inin.bcf.smartclient.ininlog</td></tr>
<tr><td>inin.updateclientapp.ininlog</td></tr>
<tr><td>interactionclient.ininlog</td></tr>
<tr><td>screencaptureclientu.ininlog</td></tr>
<tr><td>screencaptureclientu_1.ininlog</td></tr>
</table>
</body>
</html>
을 표시 나는이 모든 작업 correctlt 여기
public static void Send_Email()
{
StringBuilder sb = new StringBuilder();
StreamReader sr = new StreamReader("Email.css");
string[] files = Directory.GetFiles(sDirectory + "-" + sSearchTerm);
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("<out bound server>");
mail.From = new MailAddress("<from address>");
mail.To.Add(sEmailAddress);
mail.Subject = "Logs from " + Environment.GetEnvironmentVariable("COMPUTERNAME") + " searched " + sDate + " for " + sSearchTerm;
sb.AppendLine("<table>");
sb.AppendLine("</table>");
sb.AppendLine("<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>");
sb.AppendLine("<html>");
sb.AppendLine("<head>");
sb.AppendLine("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>");
sb.AppendLine("<style type='text/css'>");
string line;
while ((line = sr.ReadLine()) != null)
{
sb.AppendLine(line);
}
sb.AppendLine("</style>");
sb.AppendLine("</head>");
sb.AppendLine("<body>");
sb.AppendLine("Here are the list of files on <b>" + Environment.GetEnvironmentVariable("COMPUTERNAME") + "</b> for date " + sDate + " that contain(s) <b><i>" + sSearchTerm + "</i></b><br/><br/>");
sb.AppendLine("<table>");
sb.AppendLine(" <tr>");
sb.AppendLine(" <th>Filename</th>");
sb.AppendLine(" </tr>");
foreach (var file in files)
{
sb.AppendLine("<tr><td>" + Path.GetFileName(file) + "</td></tr>");
}
sb.AppendLine("</table>");
sb.AppendLine("</body>");
sb.AppendLine("</html>");
mail.IsBodyHtml = true;
mail.Body = sb.ToString();
SmtpServer.Port = 587;
SmtpServer.Credentials = new NetworkCredential("<user>", "<pass>");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
라는 메시지 뒤에 HTML 코드는 다음
table, thead, th, tr, td {
border: 1px solid black;
padding:5px;
border-collapse:collapse;
}
table {
margin-bottom:10px;
}
th {
background:grey;
color:white;
}
tbody tr:nth-child(even) {
background-color: #bada55;
}
tbody tr:nth-child(odd) {
background-color: lightblue;
}
의 CSS되는 구문 분석하고있다가 있었다 생각
다음은 처음 두 이미지는 Outlook 2013/owa이고 다른 이미지는 모바일 이메일 및 Mac 용 Outlook입니다
,
어떤 아이디어?