11-07-2013 02:56 PM
Purpose: send an email when error happens and when test running end.
Here is the script:
Subject="Test Status of "&Environment.Value("TestName")
Select case Reporter.RunStatus
Case "1" Body="Fail"
Case "2" Body="Done"
Case "3" Body="Warning"
Case "0" Body="Pass"
Case Else Body="Unexpected result"
'Create a new outlook mail object
'Add the email address to the recipient list of the message
'Add the subject of the message
'Add the body of the mail message
'Add the attachment to the mail message
If (Attachment <> "") Then
'Send the mail message
Set Mail = Nothing
Set ol = Nothing
Issue: emails are stuck in outbox of outlook.
Any solution for this?
12-02-2013 07:28 AM
This is VBScript issue independent of QTP/UFT and therefore out of scope of this forum and HP Support.
However, I tested your script and think that the problem is with quiting Outlook before sending the mail is complete.
(You can check this by commenting out ol.Quit > Is item sent correctly in this case?)
Maybe you should check your Outbox first for any left items before proceeding with ol.Quit.
Check Outlook Object model for available objects with methinds and properties to use for this: http://msdn.microsoft.com/en-us/library/office/ff8
Hope this helps.
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”