Do you forget sending the status every day after script run?
Why to worry, ask VBScript to do it. Update the status excel
file by manually or by QTP, double click on the status.vbs file (copy below
script and save as status.vbs) or if your lazy to double click, just create Windows Task Scheduler
and set the time.
This script will send status by reading the data from excel
and attaché in body of mail as text.
********************************************************************
Function GetData()Dim x, strTemp, objExcel, objWB
Set objExcel = Wscript.CreateObject("Excel.Application")
Set objWB = objExcel.Workbooks.Open("D:\Test.xlsx")
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
' Make Excel visible while debugging
objExcel.Visible = True
' This is the row of our first cell.
x = 2
do while objExcel.Cells(x, 1).Value <> ""
strTemp =strTemp & objExcel.Cells(x, 1).Value &_
Space(25)
strTemp = strTemp & objExcel.Cells(x, 2).Value &_
Space(30)
strTemp = strTemp & objExcel.Cells(x, 3).Value & vbCRLF
x = x + 1
loop
' This will prevent Excel from prompting us to save the workbook.
objExcel.ActiveWorkbook.Saved = True
' Close the workbook and exit the application.
objWB.Close
objExcel.Quit
set objWB = Nothing
set objExcel = Nothing
GetData = strTemp
End Function
'*******************************************
sendmail()
Sub sendmail()
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
'Enable SSL Authentication
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
'Value of 1 enables basic authnetication,
'2 enables NTLM Authentication,
'0 disables Authentication
'Enter your gmail address from which you would like to send mail.
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "test@gmail.com"
'Enter Password
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = ""
'Enter smtpserver, if it is gmail enter as smtp.gmail.com and if it is hotmail smtp.live.com
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Value of 2 means send using port
'value of 1 means send using a local SMTP server
'value of 3 means send using Exchange Server
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'The SMTP Port which must be enabled in your network by ISP or local Firewall
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "test1@gmail.com"
.CC = ""
.BCC = ""
.From = "test@gmail.com"
.Subject = "Status"
strBody = "Sl.No:" & Space(15) & "Test Case Name" & Space(25) & "Status" & vbCRLF
' Here we call the function GetData to populate the body text.
strBody = strBody & GetData
.textBody = strBody
'.AddAttachment "D:\Test1.txt"
'Local path of the file to attached
'For attaching another file,
'repeat the line with new path
.Send
MsgBox "Sent Mail"
End With
End Sub
***************************************************************************