Fly*_*wat 11 vbscript asp-classic
我正在对使用经典ASP/VbScript编写的旧应用程序进行一些修改.
它具有向应用程序成员发送电子邮件的功能,但由于成员列表非常大,服务器在发送前一百个左右后拒绝新的电子邮件.
我写了一些代码,让它发送20个爆炸的电子邮件,但这仍然不起作用.我认为也许让它在爆发之间睡一会儿可能会正常工作.
但是,我似乎无法在VbScript中找到Thread.Sleep类型方法.
有吗?
此例程等待任何时间,并且不使用CPU:
Function asp_Wait(nMilliseconds) Dim oShell '' VBS: Set oShell= Wscript.CreateObject("WScript.Shell") '' ASP: Set oShell= Server.CreateObject("WScript.Shell") Call oShell.run("ping 1.1.1.1 -n 1 -w " & nMilliseconds,1,TRUE) '' Option TRUE: Wait until ping is complete '' 1000 milli-second wait is 1 second End Function
您可以使用 :
<html>
<head>
<title>Sleep</title>
</head>
<body>
<%
function Sleep(seconds)
set oShell = CreateObject("Wscript.Shell")
cmd = "%COMSPEC% /c timeout " & seconds & " /nobreak"
oShell.Run cmd,0,1
End function
Sleep(5)
response.write("End")
%>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)