I have been facing one issue while sending mail using outlook 2010 in my application.
When I click button to execute mail functionality, one dialog box appears which is asking user to allow or deny application to send mail using outlook account. If I allow then email will be sent successfully but if deny then I am getting this error
'Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))'.
What is possible way to send mail without asking user for his approval.
The following code should do your job:
app = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.NameSpace ns = app.GetNamespace("MAPI");
f = ns.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
Thread.Sleep(5000); // a bit of startup grace time.
The other way to do it is by getting Inspector object for newly created
Outlook.Application oApp = new Outlook.Application();
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
Outlook.Inspector oInspector = oMsg.GetInspector;
The latter answer was published in Google groups originally for Outlook 2007 but it should work for Outlook 2010 too
User contributions licensed under CC BY-SA 3.0