主题:为什么在使用CDO组件发邮出现错误
在使用VB使用CDO组件发邮出现错误 ,错误代码为-2147220975 80040211
Public Sub smtpTry()
Dim objEmail As Object
Dim strName As String
strName = "http://schemas.microsoft.com/cdo/configuration/"
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "18980279029@163.com" '指定发送的邮箱
objEmail.To = "18980279029@139.com" '指定目的邮箱
objEmail.Subject = "邮件主题" '主题
objEmail.TextBody = "内容" '发送的内容
objEmail.Configuration.Fields.Item(strName & "sendusing") = 2
objEmail.Configuration.Fields.Item(strName & "smtpserver") = "smtp.qq.com" '服务器
objEmail.Configuration.Fields.Item(strName & "smtpserverport") = 25
objEmail.Configuration.Fields.Item(strName & "smtpauthenticate") = 1
objEmail.Configuration.Fields.Item(strName & "sendusername") = "m18980279029" '用户名
objEmail.Configuration.Fields.Item(strName & "sendpassword") = "123456" '密码
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
objEmail.Configuration.Fields.Update
objEmail.Send
End Sub