C#????Outlook API -- ???????
???????????? ???????[ 2013/12/12 10:14:56 ] ????????
????????????????????Outlook API???????о???????????????????????(C#???)????Outlook???????????????????????????????д???????????????????????html???????檔???????????£?
?????????д????????????????????
????????????html????
??????????????????????????????????
?????????????????£?
????1. ??????á?
???????? Reference ??? -> COM tab -> Microsoft Outlook 12.0 Object Library.
???????????????б??ж???“System.Office.Interop.Outlook”.
??????????????????“using Microsoft.Office.Interop.Outlook;”.
????2. ?????????
# generate email automatically
private string GenerateEmail()
{
# default content of mail?? sender will modify and verify before sending out
string hello = "Hi??<br><br>This is an example for sending automatic email via outlook.<br><br>Thanks??";
# html report that is gennerated automatically
string report = "<html>report content.</html>";
ApplicationClass app = new Microsoft.Office.Interop.Outlook.ApplicationClass();
MailItem mail = (MailItem)app.CreateItem(OlItemType.olMailItem); # create mail object
mail.SendUsingAccount = app.Session.Accounts[1]; # sender
string date = DateTime.Today.Month + "-" + DateTime.Today.Day + "-" + DateTime.Today.Year; # current date??format “7-10-2013”
mail.Subject = "[" + date + "?? pass] Smoke Test Report"; # email subject
mail.To = "to_1@***.com"; # To list
mail.CC = "cc_1@***.com;cc_2@***.com;"; # cc list
mail.BodyFormat = OlBodyFormat.olFormatHTML; # email is in html format
mail.HTMLBody = hello + report + ReadSignature(); # email content
mail.Display(); # popup email interface before sending
}
|
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11