windows 从批处理脚本发送电子邮件。布拉特不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7754908/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Send email from a batch script. Blat doesn't work
提问by GG.
I need to send an email from a batch script. I tried several solutions without success.
我需要从批处理脚本发送电子邮件。我尝试了几种解决方案都没有成功。
For example, with Blat:
例如,使用Blat:
:send_mail
"\Program Files (x86)\blat275\full\blat.exe"
-server smtp.gmail.com
-port 525
-f [email protected]
-to [email protected]
-s "hello"
-body "world"
When I run the script, I just get a Windows crash:
当我运行脚本时,我只是遇到了 Windows 崩溃:
Does someone have a better solution?
有人有更好的解决方案吗?
EDIT & SOLUTION
编辑和解决方案
I tried on our server (with our smtp) and it worked with Blat. See the full codein my answer below.
我在我们的服务器上尝试过(使用我们的 smtp)并且它与 Blat 一起工作。请参阅下面我的答案中的完整代码。
回答by Kaelan Fouwels
Realize this is old, but for any googlers:
意识到这是旧的,但对于任何谷歌员工:
Blat will NOTwork with gmail, as it requires an SSL connection to be accessed over SMTP, which blat doesn't (as of 06/02/2013) support
Blat不适用于 gmail,因为它需要通过 SMTP 访问 SSL 连接,而Blat不支持(截至 2013 年 6 月 2 日)
See here: http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/for a (slightly messy) workaround.
请参阅此处:http: //www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/以获取(稍微凌乱的)解决方法。
回答by GG.
With Blaton my server:
在我的服务器上使用Blat:
SET [email protected],[email protected]
SET server=127.0.0.1
SET port=25
SET [email protected]
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"
回答by romar
回答by Admin
Blat do not support SSL/TLS mail servers. This is why you can't send an email.
Blat 不支持 SSL/TLS 邮件服务器。这就是您无法发送电子邮件的原因。
Use Mail Alert Simple Mailer instead of Blat: https://sourceforge.net/projects/mail-alert/
使用 Mail Alert Simple Mailer 而不是 Blat:https://sourceforge.net/projects/mail-alert/