How to send mail from outlook in qtp
Code mentioned below will send mail to aTO from outlook. Make sure that outlook is open before you run this code.
'create an outlook object
Set Outlook = CreateObject("Outlook.Application")
Dim Message
'create a mail object
Set Message = Outlook.CreateItem(0)
With Message
'display the mail
.display
'set the subject of the mail
.Subject = "Subject"
'set the body of the mail
.HTMLBody = "TextBody"
'add the recipients for the mail
.Recipients.Add "reply2sagar@gmail.com"
'to add the attachments to mail use below line of code.
'.attachments.Add "f:\class.txt"
'send the mail.
.Send
End With
No comments:
Post a Comment
Please Leave your reply. We value your feedback and inputs