【发布时间】:2012-03-05 17:19:18
【问题描述】:
未处理的类型异常 'System.Runtime.InteropServices.COMException' 发生在 我的程序.exe
附加信息:操作中止(HRESULT 异常: 0x80004004 (E_ABORT))
以下代码是导致错误的原因:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim AppOutlook As New outlook.Application
Dim OutlookMessage As outlook.MailItem = AppOutlook.CreateItem(outlook.OlItemType.olMailItem)
AppOutlook = CreateObject("Outlook.Application")
Dim Recipents As outlook.Recipients = OutlookMessage.Recipients
Recipents.Add("oliverbroomhall1712@hotmail.co.uk")
OutlookMessage.Subject = "Sending through Outlook"
OutlookMessage.Body = "Testing outlook Mail"
OutlookMessage.Send()
OutlookMessage = Nothing
AppOutlook = Nothing
End Sub
在第 7 行发现错误:
Dim Recipents As outlook.Recipients = OutlookMessage.Recipients
如果不是太复杂,有没有办法在没有前景的情况下做到这一点?因为当用户没有安装 Outlook 时会发生什么?如果有人可以帮助我,我需要一种从我的应用程序发送电子邮件的方法:)
【问题讨论】:
标签: vb.net email error-handling outlook send