Does QTP have a way to send email from Outlook?
Question ID: 104986
0
0

I would like to be able to email screenshot files and other information from QuickTest when the script is running. I don’t see any menu item in QTP to do this.

Marked as spam
Posted by (Questions: 227, Answers: 22)
Asked on April 30, 2013 3:40 pm
128 views
Answers (1)
3
Private answer

You can use the Outlook Application object to send email. In the example below, you can create a function (or remove the function wrapper if you want to email directly in the script instead of from a function library). Also, there are two examples provided below the function definition that show how to use the function.

Function SendMail(SendTo, Subject, Body, Attachment)
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
End Function

Function call without an attachment:

SendMail (''test@test.com'', ''This is the subject'', ''Here is some email text'','''')

Function call with an attachment:

SendMail (''test@test.com'', ''This is the subject'', ''Here is some email text'',''C:Documentsscreenshot.jpg'')

Marked as spam
Posted by (Questions: 2, Answers: 477)
Answered on April 30, 2013 3:41 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top