標籤:telnet smtp windows
建立一個指令檔,名字隨意,副檔名vbs
subject=WScript.Arguments(0)content=WScript.Arguments(1)set sh=WScript.CreateObject("WScript.Shell")host=WScript.FullNameIf LCase(Right(host,11))="wscript.exe" Then sh.run "cscript //nologo """ & WScript.ScriptFullName & Chr(34), 0 WSCript.QuitEnd Ifsh.Run "cmd.exe"WScript.Sleep 1000sh.SendKeys "telnet"sh.SendKeys("{Enter}")WScript.Sleep 1000sh.SendKeys "open smtp.somesome.com 25" sh.SendKeys("{Enter}")WScript.Sleep 1000sh.SendKeys "helo somesome.com" sh.SendKeys("{Enter}")WScript.Sleep 500sh.SendKeys "auth login" sh.SendKeys("{Enter}")WScript.Sleep 500sh.SendKeys "xxxxxxx" sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys "xxxxxxx" sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys "mail from:<[email protected]>" sh.SendKeys("{Enter}")WScript.Sleep 500sh.SendKeys "rcpt to:<[email protected]>" sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys "rcpt to:<[email protected]>" sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys "data" sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys "from:test1" sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys "to:test2" sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys "subject:" & subject sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys "" sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys content sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys "" sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys "." sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys("{Enter}")WScript.Sleep 1000sh.SendKeys "quit" sh.SendKeys("{Enter}")WScript.Sleep 5000sh.SendKeys("{Enter}")WScript.Sleep 2000sh.SendKeys "quit" sh.SendKeys("{Enter}")WScript.Sleep 100sh.SendKeys("exit{Enter}")WScript.Quit
啟動指令碼,傳入參數:
cscript //Nologo SendMail3.vbs subject-%time% content111
本文出自 “zl1030的記錄” 部落格,請務必保留此出處http://zl1030.blog.51cto.com/274507/1926402
Windows下通過指令碼自動發郵件