Micro Focus QTP (UFT) Forums
Sending QTP report to mail - 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: Sending QTP report to mail (/Thread-Sending-QTP-report-to-mail)



Sending QTP report to mail - vamshiram - 06-12-2008

Hi

Please any one can let me know

How to sent the report generated by the QTP to our mail box

any specific code for that..

I tried with the report functions they are not so helpfull to me

Regards
Vamshi


RE: Sending QTP report to mail - namitarayudu - 06-12-2008

Hi,

Please try the following vb script and change the ToAddress and other variables accordingly. I think this will help you.

Code:
'=========================================================================

'Email generation VB Script snipet.
'NamitRayudu
'Pre requisite: MS Outlook apllication up running on the desktop
'----------------------------------------------------------------------------------

Dim ToAddress
Dim Subject
Dim Body
Dim Attachment
Dim oUtlookApp, nAmeSpace, newMail

'SystemUtil.Run "C:\Program Files\Microsoft Office\Office11\OUTLOOK.EXE" 'This line should be enabled if the Outlook on the desktop is not running

ToAddress = "abc@test.com" ' Message recipient Address

Set oUtlookApp = CreateObject("Outlook.Application")

Set nAmeSpace = oUtlookApp.GetNamespace("MAPI")

Set newMail = oUtlookApp.CreateItem(0)

Subject = "This is a test mail" 'Message Subject you can update

Body = "This the message for testing. " 'Message body you can update

newMail.Subject = Subject

newMail.Body = Body & vbCrLf

newMail.Recipients.Add(ToAddress)

newMail.Attachments.Add("C:\worklist.txt") 'You can update attachment file name

newMail.Send

Set nAmeSpace = Nothing

Set oUtlookApp = Nothing

'end of the email generation code===================================================================

Thanks,
NamitaRayudu


RE: Sending QTP report to mail - vamshiram - 06-13-2008

Thank you very much

vamshi