【发布时间】:2016-07-01 01:30:44
【问题描述】:
我正在寻找一种方法来阅读和使用 Outlook 2013 中的快速步骤,但我在该语言的文档中找不到任何内容。 到目前为止,这是我的代码:
using livingTheFantasy = Microsoft.Office.Interop.Outlook;
using OutlookApp = Microsoft.Office.Interop.Outlook.Application;
namespace outlookPrimeiro
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
String toEmail = "to@email.com";
String ccEmail = "cc@email.com";
//String bccEmail = "";
String subjectEmail = "using Outlook 2013";
String body = "body";
OutlookApp appDoOutlook = new OutlookApp();
livingTheFantasy.MailItem itemDoMail = appDoOutlook.CreateItem(livingTheFantasy.OlItemType.olMailItem);
string accName = "from@email.com";
livingTheFantasy.NameSpace sessao = itemDoMail.Session;
livingTheFantasy.Accounts contaAccounts = sessao.Accounts;
for (int i = 1; i <= contaAccounts.Count; i++)
{
livingTheFantasy.Account contaAccount = contaAccounts[i];
if (contaAccount.DisplayName.ToLower() == accName.ToLower())
{
itemDoMail.SendUsingAccount = contaAccount;
Marshal.ReleaseComObject(contaAccount);
break;
}
}
itemDoMail.To = toEmail;
itemDoMail.CC = ccEmail;
//itemDoMail.BCC = bccEmail;
itemDoMail.Subject = subjectEmail;
itemDoMail.HTMLBody = body;
itemDoMail.Importance = livingTheFantasy.OlImportance.olImportanceHigh;
//itemDoMail.Send();
itemDoMail.Display(false);
Marshal.ReleaseComObject(contaAccounts);
Marshal.ReleaseComObject(sessao);
}
}
}
【问题讨论】:
标签: asp.net outlook ms-office exchange-server