Monday, 28 November 2011

Sending Email using QTP

‘ ++++++++++++++Sending Email+++++++++++++++++++++++
Bother,  you will forget to  send the reports to your reporting person.
Use these coding in your Test or Component script that automatically send the report status to corresponding people whom you want.  Use the following scripting code as follows,
   ‘Function SendMail(SendTo, Subject, Body, Attachment)
    Set ol=CreateObject(“Outlook.Application”)
    Set Mail=ol.CreateItem(0)
    Mail.to= “vinodrajput.256@gmail.com”
    Mail.Subject=”Hi.. i am subjectl”
    Mail.Body=”Hi Gm, this is test body”
   ‘  Attach the reporting file that contains the status report.
    If (Attachment <> “”) Then 
        Mail.Attachments.Add(Attachment)
     End If
     Mail.Send
     ol.Quit
     Set Mail = Nothing
     Set ol = Nothing
 ’End Function
 ++++++++++++++++++++++++++++++++++++++++++++++++++

No comments:

Post a Comment