1 NameSpace = "http://schemas.microsoft.com/cdo/configuration/" 2 Set Email = CreateObject("CDO.Message") 3 Email.From = "XXX@YY.com" 4 Email.To = "XXX@YY.com" 5 Email.CC = "" 6 Email.Subject = "mail subject" 7 Email.Textbody = "OK!" 8 Email.AddAttachment "C:111.txt" 9 Email.Configuration.Fields.Item(NameSpace &"sendusing") = 2 10 Email.Configuration.Fields.Item(NameSpace & "smtpserver")= "smtp.YY.com" 11 Email.Configuration.Fields.Item(NameSpace & "smtpserverport")= 25 12 Email.Configuration.Fields.Item(NameSpace & "smtpauthenticate") = 1 13 Email.Configuration.Fields.Item(NameSpace & "sendusername")= "username" 14 Email.Configuration.Fields.Item(NameSpace & "sendpassword")= "password" 15 Email.Configuration.Fields.Update 16 Email.Send
可以获取当前测试用例执行状态,然后发送不同的mail
1 Select Case Reporter.RunStatus 2 Case micFail 3 Call doFailStatusEmail() 4 Case micWarning 5 Call doWarningStatusEmail() 6 Case micPass 7 'Everything is fine 8 End Select