An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in myprogram.exe通過Outlook中的Outlook發送電子郵件時出錯?
Additional information: Operation aborted (Exception from 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("[email protected]")
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時發生了什麼?我需要一種方法來從我的應用程序發送電子郵件,如果有人能幫助我:)
我得到以下行錯誤: – user1196604 2012-02-14 12:29:51
昏暗SMTP作爲新SmtpClient() – user1196604 2012-02-14 12:30:00
昏暗的電子郵件作爲MAILMESSAGE新() – user1196604 2012-02-14 12:30:10