1
Classic ASPまたはコマンドラインVBScriptアプリケーションが電子メールの送信に失敗する方法を理解しようとしています。以下のスクリプトは、さまざまなソースに基づいています。 Windows 7 VMのコマンドラインから実行しようとすると、エラーが発生するWindows 7のVBScriptを使用して電子メールを送信
CDO.Message.1: "SendUsing"設定値が無効です。
問題は、そのエラーを解決すると言われている例からスクリプトを作成しました。何かアドバイス?
Dim fso, stderr, inX, mail, buf, schemaNode
Set fso = CreateObject("Scripting.FileSystemObject")
Set StdErr = fso.GetStandardStream(2)
Set mail = CreateObject("CDO.Message")
schemaNode = "http://schemas.microsoft.com/cdo/configuration/"
With mail.Configuration.Fields
.Item(schemaNode & "sendusing") = 2 'Send the message using the network (SMTP)
.Item(schemaNode & "smtpserver") = "my/mail/server"
.Item(schemaNode & "smtpserverport") = 25
.Item(schemaNode & "smtpserverpickupdirectory") = "C:\TEMP"
End With
buf = ""
mail.From = "[email protected]/domain"
mail.To = "some/[email protected]/domain"
mail.Subject = "Test - via VBScript - " & fso.getTempName()
Set inX = fso.OpenTextFile("template.txt", 1)
Do While inX.AtEndOfStream = False
buf = buf & inX.ReadLine
Loop
mail.TextBody = buf
mail.Send()
StdErr.WriteLine("OK.")