开发者

Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))

开发者 https://www.devze.com 2023-03-17 14:01 出处:网络
Code snippet : public static void SendEmail(string _ToEmail, string _Subject, string _EmailBody) { oApp = new Microsoft.Office.Interop.Outlook.Application();

Code snippet :

  public static void SendEmail(string _ToEmail, string _Subject, string _EmailBody)
{
    oApp = new Microsoft.Office.Interop.Outlook.Application();
    Microsoft.Office.Interop.Outlook.MailItem email = (Microsoft.Office.Interop.Outlook.MailItem)(oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem));
    email.Recipients.Add(_ToEmail);
    email.Subject = _Subject;
    email.Body = _EmailBody;
    ((Microsoft.Office.Interop.Outlook.MailItem)email).Send();
}

this method works well when i tested it in another project(located in file system) but when tried to test it from IIS (virtual site);It thr开发者_如何学Goow this exception in line : email.Recipients.Add(_ToEmail);

any help will be appreciated

P.S. the ASPNET account has the administrator permission

thanks in advance.


Make sure that the reference is set in your web.config

0

精彩评论

暂无评论...
验证码 换一张
取 消