Micro Focus QTP (UFT) Forums

Full Version: Comparing the mail content through QTP/DP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Friends,

I want to fatch a particular mail from inbox and send as a text file to a desired location. After the mail is exported as a text file, that mail should be erased from inbox. From the text file, I can compare the mail content and publish the result. Do you have any idea to do this functionality using QTP. if anybody having the script to do this functioanlity. please mail me.

Thanks
Jegan.
gsjegan@gmail.com.
This is a script for reading an email from outlook inbox, and copying it to a notepad file and deleting that particular mail from inbox

Code:
Set MailItem = createobject("outlook.application")
Set mailfolder = MailItem.GetNameSpace("Mapi").pickfolder

Set fo = createobject("scripting.filesystemobject")
Set f = fo.createtextfile(<filepath>)

f.writeline "Sender: "&mailfolder.items(1).sendername
f.writeline ""
f.writeline "Subject: "&mailfolder.items(1).subject
f.writeline ""
f.writeline "Sent On: "&mailfolder.items(1).senton
f.writeline ""
f.writeline "Body: "&vbcrlf&mailfolder.items(1).body

mailfolder.items(1).delete