Thursday, June 17, 2010

Send an attachment in email thru vb.net

Hi,You could send an email attachment thru your vb.net application with the use of below code

Dim oOutL As New Outlook.Application
Dim oMail As Outlook.MailItem
oMail = oOutL.CreateItem(Outlook.OlItemType.olMailItem)
oMail.UnRead = True
oMail.To = xyz@aaaaaa.net
oMail.Subject = "Test email"
oMail.HTMLBody = True
oMail.Body = "Test email"
oMail.Attachments.Add("c:\Mail.pdf")
oMail.Send()
oMail = nothing
oOutL = nothing

by putting oMail.Display() instead of oMail.Send()
you could view the out look page to modify mail body

No comments:

Post a Comment