Send email using ms-outlook
This code shows how to send email using MS-Outlook.You need to add reference of Microsoft Outlook 12.0 Object Library in your project .i.e.
Interop.Microsoft.Office.Core.dll,
Interop.Microsoft.Office.Interop.Outlook.dll and
Interop.Outlook.dll should be included in the bin directory.The dll's are present in the attachment.
Also MS-Outlook 2003 or higher version should be installed on the pc where the code executes.
'Create the object of ms-outlook.
Dim objOutlookApp As New Outlook.Application
Dim objMail As Outlook._MailItem
objMail = objOutlookApp.CreateItem(Outlook.OlItemType.olMailItem)
objMail.BodyFormat = Outlook.OlBodyFormat.olFormatHTML
'Subject of the mail
objMail.Subject = "Test mail"
'Content of the mail
objMail.HTMLBody = "This is test mail"
'The target mail id.
objMail.To = "test@rediffmail.com"
'The person receving this mail should not send receipt
'about receiving the mail.For this ReadReceiptRequested
'is set to false.
objMail.ReadReceiptRequested = False
'Send the mail.
objMail.Send()
'Destroy the object of the mail.
objMail = Nothing
Hi Mr.programmer,
Very usefull info..
Thanks for sharing with all of us.
regards,
harshitha