Windows下通過指令碼自動發郵件

來源:互聯網
上載者:User

標籤: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下通過指令碼自動發郵件

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.