如何解决运行时错误 -2147219712 (80040600):` The operation failed
How do I resolve Runtime Error -2147219712 (80040600):` The operation failed
以下代码片段适用于 Windows 10 / Outlook 2013。
在 Windows 10 / Outlook 2016 中,我在 .send
行收到错误消息:
Run-time error -2147219712 (80040600):` The operation failed.
The messaging interfaces have returned an unknown error. If the problem persists, restart Outlook. Cannot resolve recipient.
Option Explicit
Sub email_test()
Dim objOutlookApp As Outlook.Application
Dim objOriginalItem As Outlook.MailItem
Dim objNewItem As Outlook.MailItem
Dim objInspector As Outlook.Inspector
Dim objRecipient As Outlook.Recipient
Dim strEmailAddress As String
Dim strSubject As String
Set objOutlookApp = GetObject(, "Outlook.Application")
Set objInspector = objOutlookApp.ActiveInspector
'Set objOriginalItem so that it can be referenced
Set objOriginalItem = objInspector.CurrentItem
'Set objNewItem to create the new message.
Set objNewItem = objOutlookApp.CreateItem(0)
'Store the original body into the new item body
'Note: objNewItemBody was altered by code not shown here
objNewItem.Body = objOriginalItem.Body
'Note: strEmailAddress was altered by code not shown here
strEmailAddress = "unique_ name@hotmail.com"
Set objRecipient = objOutlookApp.Session.CreateRecipient(strEmailAddress)
objRecipient.Resolve
MsgBox ("The objrecipient.resolved status is: " & objRecipient.Resolved)
'Set the fields of the MailItem. Note: objNewItem.Body was previously set
With objNewItem
.Display
.Subject = objOriginalItem.Subject
.To = objRecipient
'Loop through the attachments in objOriginalItem
'Save them to the user's temp folder.
'Attach them to objNewItem.
.Send
End With
EXUNT:
Set objOutlookApp = Nothing
Set objOriginalItem = Nothing
Set objNewItem = Nothing
Set objInspector = Nothing
End Sub
在 Outlook 2016 中,MsgBox
表示“True”,用户界面有一个 window 打开的新邮件对象,格式正确的电子邮件地址就在那里。
当我单击“收件人”字段然后单击“发送”时,电子邮件已发送。
Outlook 2013 生成一个 MsgBox
指示“False”,但无论如何它都会在用户干预下发送电子邮件。
如何在 Outlook 2016 中解决此问题以在没有用户干预的情况下发送电子邮件?
0x80040600
是 MAPI_E_CORRUPT_STORE
。如果是 PST 存储,这很可能意味着 PST 文件已损坏 - 尝试 运行 scanpst.exe 反对它。如果是缓存的 Exchange 存储,请尝试删除 OST 文件并重新启动 Outlook - 它将重建 OST 文件。
可以在 OutlookSpy(我是它的作者)中查找 MAPI 错误代码 - 单击 OutlookSpy 功能区上的“错误代码查找”。
0x80040600
是 MAPI_E_CORRUPT_STORE
。如果是 PST 存储,这很可能意味着 PST 文件已损坏 - 尝试 运行 scanpst.exe。如果是缓存的 Exchange 存储,请尝试删除 OST 文件并重新启动 Outlook - 它将重建 OST 文件。
MAPI 错误代码可以在 OutlookSpy 中查找(我是它的作者 - 单击 OutlookSpy 功能区上的“错误代码查找”)。
以下代码片段适用于 Windows 10 / Outlook 2013。
在 Windows 10 / Outlook 2016 中,我在 .send
行收到错误消息:
Run-time error -2147219712 (80040600):` The operation failed.
The messaging interfaces have returned an unknown error. If the problem persists, restart Outlook. Cannot resolve recipient.
Option Explicit
Sub email_test()
Dim objOutlookApp As Outlook.Application
Dim objOriginalItem As Outlook.MailItem
Dim objNewItem As Outlook.MailItem
Dim objInspector As Outlook.Inspector
Dim objRecipient As Outlook.Recipient
Dim strEmailAddress As String
Dim strSubject As String
Set objOutlookApp = GetObject(, "Outlook.Application")
Set objInspector = objOutlookApp.ActiveInspector
'Set objOriginalItem so that it can be referenced
Set objOriginalItem = objInspector.CurrentItem
'Set objNewItem to create the new message.
Set objNewItem = objOutlookApp.CreateItem(0)
'Store the original body into the new item body
'Note: objNewItemBody was altered by code not shown here
objNewItem.Body = objOriginalItem.Body
'Note: strEmailAddress was altered by code not shown here
strEmailAddress = "unique_ name@hotmail.com"
Set objRecipient = objOutlookApp.Session.CreateRecipient(strEmailAddress)
objRecipient.Resolve
MsgBox ("The objrecipient.resolved status is: " & objRecipient.Resolved)
'Set the fields of the MailItem. Note: objNewItem.Body was previously set
With objNewItem
.Display
.Subject = objOriginalItem.Subject
.To = objRecipient
'Loop through the attachments in objOriginalItem
'Save them to the user's temp folder.
'Attach them to objNewItem.
.Send
End With
EXUNT:
Set objOutlookApp = Nothing
Set objOriginalItem = Nothing
Set objNewItem = Nothing
Set objInspector = Nothing
End Sub
在 Outlook 2016 中,MsgBox
表示“True”,用户界面有一个 window 打开的新邮件对象,格式正确的电子邮件地址就在那里。
当我单击“收件人”字段然后单击“发送”时,电子邮件已发送。
Outlook 2013 生成一个 MsgBox
指示“False”,但无论如何它都会在用户干预下发送电子邮件。
如何在 Outlook 2016 中解决此问题以在没有用户干预的情况下发送电子邮件?
0x80040600
是 MAPI_E_CORRUPT_STORE
。如果是 PST 存储,这很可能意味着 PST 文件已损坏 - 尝试 运行 scanpst.exe 反对它。如果是缓存的 Exchange 存储,请尝试删除 OST 文件并重新启动 Outlook - 它将重建 OST 文件。
可以在 OutlookSpy(我是它的作者)中查找 MAPI 错误代码 - 单击 OutlookSpy 功能区上的“错误代码查找”。
0x80040600
是 MAPI_E_CORRUPT_STORE
。如果是 PST 存储,这很可能意味着 PST 文件已损坏 - 尝试 运行 scanpst.exe。如果是缓存的 Exchange 存储,请尝试删除 OST 文件并重新启动 Outlook - 它将重建 OST 文件。
MAPI 错误代码可以在 OutlookSpy 中查找(我是它的作者 - 单击 OutlookSpy 功能区上的“错误代码查找”)。