System.Runtime.InteropServices.COMException(0x80004004):操作在Microsoft.Office.Interop.Outlook._MailItem.Send()异常中止(来自HRESULT的异常:0x80004004(E_ABORT))异常 [英] System.Runtime.InteropServices.COMException (0x80004004): Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)) at Microsoft.Office.Interop.Outlook._MailItem.Send() Exception

查看:223
本文介绍了System.Runtime.InteropServices.COMException(0x80004004):操作在Microsoft.Office.Interop.Outlook._MailItem.Send()异常中止(来自HRESULT的异常:0x80004004(E_ABORT))异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码通过outlook发送电子邮件。但它抛出 
" System.Runtime.InteropServices.COMException(0x80004004):操作已中止(来自HRESULT的异常:0x80004004(E_ABORT) ))  at Microsoft.Office.Interop.Outlook._MailItem.Send()  at
ExcelAutomate2.Form1.sendEMailThroughOUTLOOK()"例外



正在打开outlook实例和创建电子邮件,但未发送电子邮件,并且发生以上异常。


请帮我解决此问题。


                

试试
            {


Outlook.Application app = new Outlook.Application();

                Outlook.MailItem mailItem = app.CreateItem(Outlook.OlItemType.olMailItem);

                mailItem.Subject ="这是主题";;
                mailItem.To =" Priyanka.Dudalkar@in.ey.com" ;;

                mailItem.Body ="这是消息。" ;;


                mailItem.Importance = Outlook.OlImportance.olImportanceHigh;

                mailItem.Display(false);

                ((Outlook._MailItem)mailItem)。发送();


        }



                






¥ b $ b            

解决方案

您好
PriyankaTD,


我尝试在我身边进行测试,发现你的代码在我这边工作正常。


没有任何错误。


它看起来你正在使用Outlook 64位版本。


但你的平台目标设置是为任何cpu设置的。


这可能是导致错误。


因此,如果您使用64位Outlook,请转到项目的属性 。


选择平台目标到X64可以在下面的图片中看到。




它可以解决您的问题。


问候


Deepak


I am using the below code to send Email through the outlook. But it throws  "System.Runtime.InteropServices.COMException (0x80004004): Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)) at Microsoft.Office.Interop.Outlook._MailItem.Send() at ExcelAutomate2.Form1.sendEMailThroughOUTLOOK() " Exception

It is opening the outlook instance and creating the email but Email is not being sent and above exception occurs.

Please help me to solve this.

                

try
            {

Outlook.Application app = new Outlook.Application();
                Outlook.MailItem mailItem = app.CreateItem(Outlook.OlItemType.olMailItem);
                mailItem.Subject = "This is the subject";
                mailItem.To = "Priyanka.Dudalkar@in.ey.com";
                mailItem.Body = "This is the message.";

                mailItem.Importance = Outlook.OlImportance.olImportanceHigh;
                mailItem.Display(false);
                ((Outlook._MailItem)mailItem).Send();

        }

                



            

解决方案

Hi PriyankaTD,

I try to make a test on my side and find that your code is working fine on my side.

There is no any error.

It looks like you are using Outlook 64 bit version.

But your setting of platform target is set for any cpu.

It is possible that this can cause the error.

So if you are using 64 bit Outlook then go to Properties of your project .

Select platform target to X64 as you can see in image below.

It can solve your issue.

Regards

Deepak


这篇关于System.Runtime.InteropServices.COMException(0x80004004):操作在Microsoft.Office.Interop.Outlook._MailItem.Send()异常中止(来自HRESULT的异常:0x80004004(E_ABORT))异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆