[英]Send email from a batch script. Blat doesn't work
我需要從批處理腳本發送電子郵件。 我嘗試了幾種解決方案,但均未成功。
例如,使用Blat :
:send_mail
"\Program Files (x86)\blat275\full\blat.exe"
-server smtp.gmail.com
-port 525
-f myAdress@gmail.com
-to recipient@foomail.com
-s "hello"
-body "world"
當我運行腳本時,我只會發生Windows崩潰:
有人有更好的解決方案嗎?
編輯與解決方案
我嘗試在我們的服務器上(使用我們的smtp),它與Blat一起使用。 請參閱下面我的答案中的完整代碼 。
意識到這是古老的,但對於任何Google員工而言:
BLAT 無法在Gmail的工作,因為它需要通過SMTP來訪問的SSL連接,這BLAT沒有(截至2013年6月2日)的支持
參見此處: http : //www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/ ,以解決(有點混亂)的問題。
在服務器上安裝Blat :
SET to=myEmail@gmail.com,myOtherEmail@gmail.com
SET server=127.0.0.1
SET port=25
SET from=bot@foo.com
SET subject="BACKUP PROBLEM"
SET year=%DATE:~6,4%
SET month=%DATE:~3,2%
SET day=%DATE:~0,2%
SET today=%year%-%month%-%day%
"\Program Files (x86)\blat275\full\blat.exe" -server %server% -port %port% -f %from% -to %to% -html -s %subject% -body "%today%: bla bla bla"
Blat不支持SSL / TLS郵件服務器。 這就是為什么您無法發送電子郵件的原因。
使用郵件警報簡單郵件程序而不是Blat: https ://sourceforge.net/projects/mail-alert/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.