Micro Focus QTP (UFT) Forums
Comparing the mail content through QTP/DP - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Comparing the mail content through QTP/DP (/Thread-Comparing-the-mail-content-through-QTP-DP)



Comparing the mail content through QTP/DP - gsjegan - 02-20-2008

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.


RE: Comparing the mail content through QTP/DP - chaitanyaponangi - 06-17-2009

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