Micro Focus QTP (UFT) Forums
Email for test results - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Email for test results (/Thread-Email-for-test-results)



Email for test results - galstar - 09-02-2010

Hi,

can we send test reports through an email to a third party...
if yes then plz suggest me the way to do it...



Thanks


RE: Email for test results - venkatbatchu - 09-03-2010

Hi,
Please use the below code you can pass the test reports(as attachments) .

Code:
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 = "venkat.batchu81@gmail.com" ' Message recipient Address

Set oUtlookApp = CreateObject("Outlook.Application")

Set nAmeSpace = oUtlookApp.GetNamespace("MAPI")

Set newMail = oUtlookApp.CreateItem(0)

Subject = "Sending Test Results  through Outlook" 'Message Subject you can update

Body = "To view the test results of login and signoff. " 'Message body you can update

newMail.Subject = Subject

newMail.Body = Body & vbCrLf

newMail.Recipients.Add(ToAddress)

newMail.Attachments.Add("C:\Documents and Settings\venkat.batchu\Desktop\Results\Log\LogFile.html") 'You can update attachment file name

newMail.Send

Set nAmeSpace = Nothing

Set oUtlookApp = Nothing

Please let me know for further clarification.


Regards,
Venkat.Batchu