Link to home
Start Free TrialLog in
Avatar of Kramarich
KramarichFlag for United States of America

asked on

Error when using Microsoft.Office.Interop.Outlook.MailItem.Send() with Office 2013

We have a VB .NET application that uses the method Microsoft.Office.Interop.Outlook.MailItem.Send() to send emails using Outlook 2007.  

Upon upgrading some of our workstations to Office 2013 64-bit, the same application now throws the error “Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))” when sending emails from Outlook 2013.  

We are aware that we could use SMTP email as a workaround, but we don’t want to use that method.  Is there a solution for this error when using MailItem.Send() with Outlook 2013?
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

use the 32 bit version of outlook and not the 64 bit version
Avatar of Kramarich

ASKER

That’s not an option for us. Our certified version is the 64-bit version.
Did you try using the office 2013 64 bit Interop DLL in the project references?

http://msdn.microsoft.com/en-us/library/vstudio/15s06t57(v=vs.120).aspx

Microsoft Outlook 15.0 Object Library
Microsoft.Office.Interop.Outlook.dll
Yes. We referenced Microsoft.Office.Interop.Outlook - 15.0 version in project references.
..hmmm.. very interesting.
Is the error thrown exactly on MailItem.Send()?

I wonder if you can use a 32-bit dll though.. since a 64 bit machine can still run it.
The first suggestion by ve3ofa, may be your solution.

What is your "Target CPU:" set to in your advanced compile properties in the project?
Also, are you catching this error in a "Try" statement?.. or is it unhandled?
Yes. We are getting the error while executing the line MailItem.Send().  I am catching it inside a "Try" block.  The Target CPU is set as "x64". We also tried AnyCPU and x86.
ASKER CERTIFIED SOLUTION
Avatar of Kramarich
Kramarich
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I would have giving a grade of F if I could have.  I wish I could tell you what finally fixed the problem but I can't.
Avatar of Sep Fraunhoffer
Sep Fraunhoffer

There is another library you need to use to get it to work. Download the sample file at https://code.msdn.microsoft.com/windowsdesktop/VB-NET-OUTLOOK-SEND-EMAIL-4956ed06 and adapt your code. Notice _Application, _MailItem, and using .To instead of .Recipients.