0

图片 --> http://i.stack.imgur.com/bKvVv.jpg

当我使用以下脚本连接到交换邮件服务器以发送我的电子邮件时,上面的登录窗口会提示我输入域凭据。如何自动化我的脚本,这样我就不会得到那个登录窗口。发送电子邮件的工作站未加入 AD 域。

Function sendMail(a,b,c)
set objMsg = CreateObject("CDO.Message")
set objConf = CreateObject("CDO.Configuration")

Set objFlds = objConf.Fields
With objFlds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "email server name"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = a
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = b
    .Update
End With

strBody = "Script has finished running, 6005 is finished"

With objMsg
    Set .Configuration = objConf
    .To = c
    .From = c
    .Subject = "[AUTO] Script has finished running!"
    .TextBody = strBody
    .Fields.update
    .Send
End With

结束功能

sendMail "username","password","my email address"

谢谢

约翰

4

1 回答 1

0

随着线

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2 

您正在请求 NTLM 身份验证。这可能会导致显示登录对话框。

请改用这个:

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 

这会导致使用sendusernameandsendpassword字段,并带有“基本身份验证”。请注意,某些电子邮件服务器被配置为拒绝“基本身份验证”。

于 2012-02-16T11:26:32.353 回答