Answered by:
Sending Emails through outlook

Question
-
Hi,
I used the following code to send emails through outlook using vb.net. I installed windows xp professioanal,ms visual studio 2005, ms outlook 2002. But i am getting the following error. Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))".
' Create an Outlook application.
Dim oApp As Object
oApp = New Outlook.Application()
'Dim oApp As Outlook._Application
'oApp = New Outlook.Application()
' Create a new MailItem.
Dim oMsg As Outlook._MailItem
oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)
oMsg.Subject = "Test-1"
oMsg.Body = "Test-1" & vbCr & vbCr
' TODO: Replace with a valid e-mail address.
oMsg.To = "abc@gmail.com"
' Add an attachment
' TODO: Replace with a valid attachment path.
Dim sSource As String = "C:\Hello.txt"
' TODO: Replace with attachment name
Dim sDisplayName As String = "Hello.txt"
Dim sBodyLen As String = oMsg.Body.Length
Dim oAttachs As Outlook.Attachments = oMsg.Attachments
Dim oAttach As Outlook.Attachment
'oAttach = oAttachs.Add(sSource, , sBodyLen + 1, sDisplayName)
' Send
oMsg.Send()
' Clean up
oApp = Nothing
oMsg = Nothing
oAttach = Nothing
oAttachs = Nothing
how to solve this error. Pls give ur suggesstions. Its very urgent. Thanks in advance.
- Moved by nobugz Thursday, July 16, 2009 12:22 PM not a bcl q (From:.NET Base Class Library)
Thursday, July 16, 2009 5:21 AM
Answers
-
The error is from Outlook. Ask in the Outlook community .
Please mark the post answered your question as the answer, and click the chartreuse pyramid floating over nothingness/null to mark other helpful posts as helpful. This posting is provided "AS IS" with no warranties, and confers no rights.
Visual C++ MVP- Marked as answer by Ed Price - MSFTMicrosoft employee Tuesday, March 27, 2012 4:43 AM
Thursday, July 16, 2009 8:35 PM -
Hi There,
Thank you for your post! I would suggest posting your question in one of the MS Forum,
Visual Basic Developer Center > Visual Basic Forums > Visual Basic General
located here: http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threadsHave a great day!
Shrikant Maske Tier 2 Application Support Server and Tools Online Engineering Live Services Team- Proposed as answer by Shrikant Maske Thursday, July 16, 2009 5:23 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Tuesday, March 27, 2012 4:43 AM
Thursday, July 16, 2009 5:22 PM
All replies
-
Hi There,
Thank you for your post! I would suggest posting your question in one of the MS Forum,
Visual Basic Developer Center > Visual Basic Forums > Visual Basic General
located here: http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threadsHave a great day!
Shrikant Maske Tier 2 Application Support Server and Tools Online Engineering Live Services Team- Proposed as answer by Shrikant Maske Thursday, July 16, 2009 5:23 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee Tuesday, March 27, 2012 4:43 AM
Thursday, July 16, 2009 5:22 PM -
The error is from Outlook. Ask in the Outlook community .
Please mark the post answered your question as the answer, and click the chartreuse pyramid floating over nothingness/null to mark other helpful posts as helpful. This posting is provided "AS IS" with no warranties, and confers no rights.
Visual C++ MVP- Marked as answer by Ed Price - MSFTMicrosoft employee Tuesday, March 27, 2012 4:43 AM
Thursday, July 16, 2009 8:35 PM