图片 --> 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"
谢谢
约翰