关于QTP发送邮件
各位大侠们,我想让QTP运行完后,将测试结果自动发送到我的邮箱中!请问该如何写这段代码呢? ' 发送邮件Function SendMail(LogFile)
Set oMessage=WScript.CreateObject("CDO.Message")
Set oConf=WScript.CreateObject("CDO.Configuration")
Set fso = CreateObject("Scripting.FileSystemObject")
'创建CDO.Configuration对象后,需要设置邮件服务器的端口、用户帐号等相关信息
oConf.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
oConf.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")=192.168.1.2
oConf.Fields("http://schemas.microsoft.com/cdo/configuration/serverport")=25
oConf.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
oConf.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername")="xxx"
oConf.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword")="xxx"
oConf.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl")=0
oConf.Fields.Update()
'通过CDO的 Message对象设置邮件主题、附件、发送人等信息
oMessage.Configuration = oConf
oMessage.To = "xxx"
oMessage.From = "xxx"
oMessage.Subject = "QTRunner Notification"
file = fso.GetAbsolutePathName(LogFile)
Set fso = Nothing
oMessage.AddAttachment( file )
TextBody = "QTRunner Finish! See attachment for logs."
oMessage.TextBody = TextBody
oMessage.Send()
End Function
参考QTRunner:
http://www.cnblogs.com/testware/archive/2010/05/14/1735545.html
回复 2# 的帖子
高手啊! http://schemas.microsoft.com/cdo/configuration這地址是什麽?用在腳本里報錯的..
請問要改成什麽 高手啊!
页:
[1]