我的.net MVC應用程序具有發送電子郵件給客戶端的邏輯,下面是發送電子郵件的代碼。如何將Bootstrap樣式應用於電子郵件正文
string strBody = @"<!DOCTYPE html><html lang='en'><head><title>Ticket Application</title><meta charset='utf-8' /><script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js'></script><link rel='stylesheet' type='text/css' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'></head><body><div class='container'><div class='row'><table class='table-condensed table-responsive'><thead><tr><th></th><th></th></tr></thead><tbody><tr class='danger'><td><label>Title</label></td><td>{title}</td></tr><tr class='active'><td><label>Description</label></td><td>{description}</td></tr><tr><td><label>Project</label></td><td>{project}</td></tr><tr><td><label>Priorty</label></td><td>{priorty}</td></tr><tr><td><label>Current Status</label></td><td>{Open}</td></tr></tbody><tfoot></tfoot></table></div></div></body></html>';";
string strToAddress = "[email protected]";
using (SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["SMTPHost"], Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"])))
{
MailMessage message = new MailMessage(ConfigurationManager.AppSettings["SMTPFromUser"],
strToAddress,
//ConfigurationManager.AppSettings["EmailSubject"],
"Test Subject",
strBody);
message.IsBodyHtml = true;
client.EnableSsl = true;
client.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["SMTPUser"], ConfigurationManager.AppSettings["SMTPPassowrd"]);
client.Send(message);message.Dispose();
client.Dispose();
}
「strBody」變量包含作爲郵件正文的HTML。 在這個HTML中,我包含了Bootstrap css和JS文件的CDN。 https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js
但我沒有看到應用到電子郵件的內容引導的風格。 請讓我知道需要做什麼,以便將引導樣式應用於電子郵件內容。