Wednesday, July 6, 2011

QTP- Sending an email using Outlook application





Following is the QTP code for sending an email using Outlook application

Dim otl,m
set otl = createobject("Outlook.Application")
set m = ot.createname(0)
m.to = "abcd@gmail.com"
m.subject = "hi"
m.body = "this is sample mail"
m.Attachment.Add("c:\test.txt")
m.send
otl.quit
set m = nothing
set otl = nothing