2010-04-05 2 views

답변

7

데이터를 표준 HTML 표로 출력하면됩니다.

그런 다음 일반 텍스트 대신 HTML 전자 메일로 보냅니다. 여기에 C#의 빠르고 더러운 예제가 있습니다 :

MailMessage msg = new MailMessage("From[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을 필요로하지 않는다 "안녕"라는 단일 행 테이블> 아웃룩에서 임시 보관함 폴더를 새 메시지를 만듭니다이

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(); 

시도 을 더한. HTML 테이블을 만드는 방법은 여러 가지가 있지만 위의 코드는 모두 보내야합니다. – Zachary

+1

'msg.IsBodyHTML = true;는'msg.IsBodyHtml = true;'이어야합니다. – aswzen

3

테이블을 만들려면 HTML 테이블 태그를 사용할 수 있습니다. 이 당신을 위해 도움이 될 것입니다

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); 

희망 : 여기

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

는 코드입니다.

0

관련 문제