51Testing软件测试论坛

标题: 现在用QTP,如何发送foxmail,发邮件,加附近等 [打印本页]

作者: cloudwindkid    时间: 2011-2-16 18:10
标题: 现在用QTP,如何发送foxmail,发邮件,加附近等
如题,我只有outlook的,现在公司只装foxmail,求助
作者: cloudwindkid    时间: 2011-2-17 09:08
自己顶下
作者: feiyunkai    时间: 2011-2-17 15:31
标题: 下面代码是个通用方法
Public Function Sendmail(mailfrom,mailto,smtp,username,password,mailtitle,mailbody,attachment)
'参数说明:
'发件人:mailfrom 收件人:mailto 邮件发送服务器:smtp 发件人邮箱地址:username 发件人邮箱密码:password 邮件标题:mailtitle 邮件内容:mailbody 附件路径:attachment
NameSpace = "http://schemas.microsoft.com/cdo/configuration/"
Set Email = createObject("CDO.Message")
Email.From =mailfrom
Email.To = mailto
Email.Subject = mailtitle
Email.Textbody = mailbody
Email.AddAttachment attachment
With Email.Configuration.Fields
.Item(NameSpace&"sendusing") = 2
.Item(NameSpace&"smtpserver") = smtp
.Item(NameSpace&"smtpserverport") = 25
.Item(NameSpace&"smtpauthenticate") = 1
.Item(NameSpace&"sendusername") = username
.Item(NameSpace&"sendpassword") = password
.update
End With
Email.Send
End Function




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2