Excel如何使用CDO脚本验证电子邮件是否已发送或失败

Excel如何使用CDO脚本验证电子邮件是否已发送或失败,excel,email,cdo,Excel,Email,Cdo,我可以发送大量电子邮件,但我如何知道电子邮件是否由于错误的电子邮件地址而未送达如果有错误处理方法从服务器获取此信息,可能我不知道该如何处理 这是我正在使用的代码的一部分 Set cdomsg = CreateObject("CDO.message") With cdomsg.Configuration.Fields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .

我可以发送大量电子邮件,但我如何知道电子邮件是否由于错误的电子邮件地址而未送达如果有错误处理方法从服务器获取此信息,可能我不知道该如何处理

这是我正在使用的代码的一部分

Set cdomsg = CreateObject("CDO.message")
With cdomsg.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = "465"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxxxx@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxxx"
.Update
End With
'==================================================================
' The procedure is to find the value in database with correspond information
'==================================================================

'(( i need the procedure to call the values ))

'===================================================================
'===================================================================
With cdomsg

strBody = strBody & "<span><br/>This Email was sent from Application </span>"

strBody = strBody & "<span>Hello : " & Name & " your pin code is: " & pincode & "</span><br/>"
   

'====================================================================
.To = user_email
.From = "xxxxx@gmail.com"
.Subject = "Pin code application"
.HTMLBody = strBody
.Send
End With
Set cdomsg = Nothing

End Function```
Set cdomsg=CreateObject(“CDO.message”)
使用cdomsg.Configuration.Fields
.项目(”http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.项目(”http://schemas.microsoft.com/cdo/configuration/smtpserver“”=“smtp.gmail.com”
.项目(”http://schemas.microsoft.com/cdo/configuration/smtpserverport") = "465"
.项目(”http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.项目(”http://schemas.microsoft.com/cdo/configuration/smtpusessl“”=真
.项目(”http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.项目(”http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxxxx@gmail.com"
.项目(”http://schemas.microsoft.com/cdo/configuration/sendpassword“”=“xxxxxx”
.更新
以
'==================================================================
'该过程是在数据库中查找具有相应信息的值
'==================================================================
“((我需要调用值的过程))
'===================================================================
'===================================================================
使用cdomsg
strBody=strBody&“
此电子邮件是从应用程序发送的” strBody=strBody&“您好:&Name&”您的pin码是:&pincode&“
” '==================================================================== .To=用户\电子邮件 .From=”xxxxx@gmail.com" .Subject=“Pin码应用” .HTMLBody=strBody .发送 以 设置cdomsg=Nothing 端函数```