0

画像 --> http://i.stack.imgur.com/bKvVv.jpg

次のスクリプトを使用して Exchange メール サーバーに接続し、電子メール メッセージを送信すると、上記のログイン ウィンドウでドメイン資格情報を要求されます。ログインウィンドウが表示されないようにスクリプトを自動化するにはどうすればよいですか。電子メールを送信するワークステーションは、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 

これにより、sendusernameおよびsendpasswordフィールドが「基本認証」で使用されます。一部の電子メールサーバーは「基本認証」を拒否するように構成されていることに注意してください。

于 2012-02-16T11:26:32.353 に答える