Function SendMail
' Declare the required variables
Dim strTextBody, MailNotification
dim strModuleName, intTotalPassed, intTotalFailed, intTotalNotExecuted
' Assign value to result.
strModuleName = "Smoke"
intTotalPassed = 10
intTotalFailed = 1
intTotalNotExecuted = 0
' Prepare the body text
strTextBody = "==================================" & vbcrlf
strTextBody= strTextBody & "Test Execution Report" & vbcrlf
strTextBody= strTextBody & "Date :" & Date & " " & Time & vbcrlf
strTextBody= strTextBody & "==================================" & vbcrlf
strTextBody= strTextBody & "Summary" & vbcrlf
strTextBody= strTextBody & "==================================" & vbcrlf
strTextBody= strTextBody & "Total Tests Passed : " & intTotalPassed & vbcrlf
strTextBody= strTextBody & "Total Tests Failed : " & intTotalFailed & vbcrlf
strTextBody= strTextBody & "Total Tests Not Executed : " & intTotalNotExecuted & vbcrlf
strTextBody= strTextBody & "==================================" & vbcrlf
strTextBody = strTextBody & "The attachment contains the" & vbcrlf & "results for the following modules:" & vbcrlf
strTextBody= strTextBody & "==================================" & vbcrlf
strTextBody= strTextBody & strModuleName
strTextBody= strTextBody & "=================================="
' Create the Mail object
Set MailNotification=CreateObject("CDO.Message")
' Set the subject
MailNotification.Subject = Environment.Value("Smoke result")
' Set the Mail From parameter
MailNotification.From = Environment.Value("Manual Team")
' Set the Mail To parameter
MailNotification.To = Environment.Value("Manager")
' Set the Mail CC parameter
MailNotification.CC = Environment.Value("Test Lead")
' Set the mail BCC parameter
MailNotification.BCC= ""
' Set the Bod of the Mail
MailNotification.TextBody= strTextBody & vbcrlf & vbcrlf & "DO NOT REPLY. This is an auto-generated mail." & vbcrlf & "Contact the administrator in case of any queries"
' Add the Attachements (Zip Attachment is global which contain required result in detail)
MailNotification.AddAttachment ZipAttachment
' Configure the mail according the smtp server settings
MailNotification.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
MailNotification.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = Environment.Value("SMTP server")
MailNotification.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
MailNotification.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0 'cdoBasic
MailNotification.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 120
' Update and send the mail
MailNotification.Configuration.Fields.Update
MailNotification.Send
' Clear the memory
Set MailNotification=nothing
Call DNALogEvent("Mail notification sent.")
End Function
' Declare the required variables
Dim strTextBody, MailNotification
dim strModuleName, intTotalPassed, intTotalFailed, intTotalNotExecuted
' Assign value to result.
strModuleName = "Smoke"
intTotalPassed = 10
intTotalFailed = 1
intTotalNotExecuted = 0
' Prepare the body text
strTextBody = "==================================" & vbcrlf
strTextBody= strTextBody & "Test Execution Report" & vbcrlf
strTextBody= strTextBody & "Date :" & Date & " " & Time & vbcrlf
strTextBody= strTextBody & "==================================" & vbcrlf
strTextBody= strTextBody & "Summary" & vbcrlf
strTextBody= strTextBody & "==================================" & vbcrlf
strTextBody= strTextBody & "Total Tests Passed : " & intTotalPassed & vbcrlf
strTextBody= strTextBody & "Total Tests Failed : " & intTotalFailed & vbcrlf
strTextBody= strTextBody & "Total Tests Not Executed : " & intTotalNotExecuted & vbcrlf
strTextBody= strTextBody & "==================================" & vbcrlf
strTextBody = strTextBody & "The attachment contains the" & vbcrlf & "results for the following modules:" & vbcrlf
strTextBody= strTextBody & "==================================" & vbcrlf
strTextBody= strTextBody & strModuleName
strTextBody= strTextBody & "=================================="
' Create the Mail object
Set MailNotification=CreateObject("CDO.Message")
' Set the subject
MailNotification.Subject = Environment.Value("Smoke result")
' Set the Mail From parameter
MailNotification.From = Environment.Value("Manual Team")
' Set the Mail To parameter
MailNotification.To = Environment.Value("Manager")
' Set the Mail CC parameter
MailNotification.CC = Environment.Value("Test Lead")
' Set the mail BCC parameter
MailNotification.BCC= ""
' Set the Bod of the Mail
MailNotification.TextBody= strTextBody & vbcrlf & vbcrlf & "DO NOT REPLY. This is an auto-generated mail." & vbcrlf & "Contact the administrator in case of any queries"
' Add the Attachements (Zip Attachment is global which contain required result in detail)
MailNotification.AddAttachment ZipAttachment
' Configure the mail according the smtp server settings
MailNotification.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
MailNotification.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = Environment.Value("SMTP server")
MailNotification.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
MailNotification.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0 'cdoBasic
MailNotification.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 120
' Update and send the mail
MailNotification.Configuration.Fields.Update
MailNotification.Send
' Clear the memory
Set MailNotification=nothing
Call DNALogEvent("Mail notification sent.")
End Function
No comments:
Post a Comment