cloudwindkid 发表于 2011-2-16 18:10:13

现在用QTP,如何发送foxmail,发邮件,加附近等

如题,我只有outlook的,现在公司只装foxmail,求助

cloudwindkid 发表于 2011-2-17 09:08:02

自己顶下

feiyunkai 发表于 2011-2-17 15:31:02

下面代码是个通用方法

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
页: [1]
查看完整版本: 现在用QTP,如何发送foxmail,发邮件,加附近等