2010-04-05 59 views

回答

7

只需在標準HTML表格中輸出數據即可。

然後將其作爲HTML電子郵件而不是純文本發送。這裏有一個快速和骯髒的例子在C#:

MailMessage msg = new MailMessage("[email protected]", "[email protected]"); 
msg.IsBodyHTML = true; 
msg.Subject = "Subject line here"; 
msg.Body = "html goes here"; 

SmtpClient mailClient = new SmtpClient("YourEmailServer"); 
mailClient.Send(msg); 
+0

上述解決方案不需要Outlook 2007中這是一個很大加。有很多方法可以創建一個HTML表格,但上面的代碼是你需要發送的。 – Zachary 2010-04-05 21:01:42

+1

'msg.IsBodyHTML = true;'應該是'msg.IsBodyHtml = true;' – aswzen 2017-07-13 07:25:06

3

爲了創建可以使用HTML表格標記的表格。

<table><tr>....</tr></table>.

下面是代碼:

MailMessage msg = new MailMessage("[email protected]", "[email protected]"); 
msg.IsBodyHTML = true; 
msg.Subject = "Subject line here"; 
msg.Body = "<table border=1><tr><td>one</td></tr><tr><td>two</td></tr>"; 

SmtpClient mailClient = new SmtpClient("YourEmailServer"); 
mailClient.Send(msg); 

希望這將是對你有幫助。

0

試試這個

using outlook = Microsoft.Office.Interop.Outlook; 

string emailSubject = "Subject of email"; 
string htmlString = "<table><tr><td>Hi</td></tr></table>"; 

outlook.Application outlookApp = new outlook.Application(); 
outlook.MailItem mailItem = (outlook.MailItem)outlookApp.CreateItem(outlook.OlItemType.olMailItem); 
mailItem.Subject = emailSubject; 
mailItem.HTMLBody = htmlString; 
mailItem.To = "[email protected]"; 

mailItem.Save(); 

這將在您的Outlook創建新的郵件>草稿文件夾的單行表,說:「嗨」

相關問題