For Eg:
In case of Microsoft Outlook 2002, Add "Microsoft Outlook 10.0 object library" and Microsoft Outlook 2003, Add "Microsoft Outlook 11.0 object library" (Right click on the project -> Add References -> Select the COM tab -> Select "Microsoft Outlook x.0 object library)
vb.net code:
Try
Dim ol As New Outlook.Application()
Dim ns As Outlook.NameSpace
Dim fdMail As Outlook.MAPIFolder
ns = ol.GetNamespace("MAPI")
ns.Logon(, , True, True)
´creating a new MailItem object
Dim newMail As Outlook.MailItem
´gets defaultfolder for my Outlook Outbox
fdMail = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox)
´assign values to the newMail MailItem
newMail = fdMail.Items.Add(Outlook.OlItemType.olMailItem)
newMail.Subject = "Subject"
newMail.Body = "Body"
newMail.To = "someone@somewhere.com"
newMail.SaveSentMessageFolder = fdMail
newMail.Send()
Catch ex As Exception
Throw ex
End Try