Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Email using Outlook and VB.net

Status
Not open for further replies.

ca8spo

Programmer
Aug 14, 2002
16
GB
I'm trying to send an email automatically using the Outlook 10.0 object library reference in VB.net

I'm using the following code:

Public Class OutlookMail

Dim oApp As Outlook.Application
Dim oNameSpace As Outlook.NameSpace
Dim oOutboxFolder As Outlook.MAPIFolder

Function SendOutlookItem()

oApp = New Outlook.Application()
oNameSpace = oApp.GetNamespace("MAPI")

oNameSpace.Logon("", "", True, True)

oOutboxFolder = oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox)

Dim oMailItem As Outlook.MailItem = oApp.CreateItem(Outlook.OlItemType.olMailItem)

oMailItem.To = "someone@somewhere.co.uk"
oMailItem.Subject = "test"
oMailItem.Body = "test"
oMailItem.SaveSentMessageFolder = oOutboxFolder

oMailItem.Send()

End Function

End Class



The problem is that I'm getting a build error -

"'Send' is ambiguous across the inherited interfaces 'Outlook._MailItem' and 'Outlook.ItemEvents_10_Event'."


Does anyone know how to solve this?

Cheers
Simon
 
Simon,

This is an unnecessary COM interface. Look up the class
System.Web.Mail

It should give you everything you need.

Craig
 
Check out this excellently written FAQ
*grin
faq796-2119 That'l do donkey, that'l do
[bravo] Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top