0
我使用下面的VB脚本发送邮件。当我从命令提示符执行它时,它会在执行后返回到命令提示符。如果发送时有任何错误,则会显示一条弹出消息。VB脚本发送邮件 - 等到发送邮件
If WScript.Arguments.Count <> 6 then
Wscript.Echo "Missing parameters"
Else
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = Wscript.Arguments(0)
objMessage.From = Wscript.Arguments(1)
objMessage.To = Wscript.Arguments(2)
objMessage.TextBody = Wscript.Arguments(3)
objMessage.AddAttachment Wscript.Arguments(4)
objMessage.AddAttachment Wscript.Arguments(5)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp server ip"
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
End If
我想知道在程序中发送电子邮件并获取objMessage.Send的状态需要多少时间。
我想使用Wscript.Echo“错误消息”显示错误。上述代码需要进行哪些更改才能执行,直到电子邮件成功发送并显示一条消息。
在此先感谢。 阿肖克