我期待從我的程序中生成一條Outlook消息,我能夠從程序內部構建和發送或構建並保存,我想要構建的然後顯示以允許用戶可以從AD列表中手動選擇收件人...下面的代碼是這裏和其他教程網站的示例混合,但是我無法找到構建,然後「顯示」電子郵件,而不保存草稿或從程序中發送它。 ..從C打開新的Outlook消息#
也是我希望找到一種方法,我可以創建一個電子郵件IE內部的UNC鏈接:寫出來的路徑,用戶文件夾\\ UNC \路徑\%USERNAME%或喜歡
private void sendEmailOutlook(string savedLocation, string packageName)
{
try
{
Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem oMsg = (Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
oMsg.HTMLBody = "Attached is the required setup files for your <i><b>soemthing</i></b> deployment package.";
oMsg.HTMLBody += "\nPlease save this file to your network user folder located.<br /><br/>\\\\UNC\\data\\users\\%USER%\\";
oMsg.HTMLBody += "\nOnce saved please boot your Virtual machine, locate and execute the file at <br /> <br />\\\\UNC\\users\\%USER%\\";
int pos = (int)oMsg.Body.Length +1;
int attachType = (int)Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue;
Microsoft.Office.Interop.Outlook.Attachment oAttach = oMsg.Attachments.Add(savedLocation, attachType, pos, packageName);
oMsg.Subject = "something deployment package instructions";
oMsg.Save();
}
catch(Exception ex)
{
Console.WriteLine("Email Failed", ex.Message);
}
[This](http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._mailitem.display.aspx)不起作用? – Herdo
@ Herdo它給我一個錯誤,但我可以通過它,它已成爲我期待的第一部分,你是否有能力回答第二部分:終端用戶的UNC路徑... – asuppa
由於您使用的是HTML格式:您是否嘗試使用簡單的html-link元素(「')? – Herdo