|
楼主 |
发表于 2011-3-9 01:57:00
|
显示全部楼层
广西壮族自治区南宁市
Private Sub Command1_Click()
Dim objEmail As Object
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "*****@qq.com"
objEmail.To = "*****@qq.com"
objEmail.Subject = "邮件主题"
objEmail.Textbody = "邮件正文"
objEmail.AddAttachment "C:\demo.txt" '附件内容
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.qq.com"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "用户名"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "密码"
objEmail.Configuration.Fields.Update
objEmail.Send
End Sub |
|