Is there a way to send an email from an API test in UFT?
Question ID: 108302
1
0

I need to send an email from an API test with UFT. Can’t seem to figure out how to do it, even with custom code.

Marked as spam
Posted by (Questions: 386, Answers: 64)
Asked on April 27, 2018 7:11 pm
27 views
Answers (1)
1
Private answer

I spent too much time trying to get C# Code to work with UFT API so I just created a GUI test and called it from my API test, passing parameters to it.

Here is basic code:

SendFrom = ''MyUser@somewhere.com''
SendTo= ''Person@somewhere.com''
Subject = ''test email''
Body = '' This only a test SENT FROM UFT ''
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

This worked quickley and easily. There's another [post about sending email from a GUI test][1].

[1]:http://eyeontesting.com/questions/4277/does-qtp-have-a-way-to-send-email-from-outlook.html

Marked as spam
Posted by (Questions: 16, Answers: 807)
Answered on April 27, 2018 7:14 pm
0
That's a great idea. I implemented it and it worked great.
( at April 27, 2018 7:14 pm)
EyeOnTesting

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

X
Scroll to Top