How to send an email from QTP

Source : QTP Google groups

Set ol=CreateObject("Outlook.Application")
Set Mail=ol.CreateItem(0)
Mail.to=SendTo
Mail.Subject=Subject
Mail.Body=Body
If (Attachment <> "") Then
Mail.Attachments.Add(Attachment)
End If
Mail.Send
ol.Quit

Set Mail = Nothing
Set ol = Nothing

--------------------------------------------------------------
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = True

qtApp.Open "scriptname", False
'qtApp.Open "C:\test", False

Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions")
qtResultsOpt.ResultsLocation = "C:\results"
Set qtTest = qtApp.Test
qtTest.Run qtResultsOpt

qtTest.Close
qtApp.Quit
Set qtApp = nothing
Set qtResultsOpt = nothing
Set qtTest = nothing

Comments

Popular Posts