我有一个批处理文件,它位于调度程序中,它总是为新的构建存在,如果存在,它会在新构建时启动自动化。我希望通过在批处理文件中添加send mail命令来获取通知,以了解调度程序批处理文件已选择新构建。
答案 0 :(得分:1)
查看Blat命令行工具。它需要快速设置来记录SMTP服务器,端口,地址等(或者你可以在每次调用时指定它们),但是一旦完成,你可以使用非常简洁的命令。
例如:
SET EmailTo=my@email.com
REM Send an email notice that the setup has started along with a timestamp.
REM First parameter as a dash indicates we will provide the body text,
REM otherwise we could specify a text file here and it will be the body.
Blat - -to %EmailTo% -subject "Setup Started" -body "Started on %DATE% - %TIME"
REM Do some stuff...
REM Send an email notice that the setup is complete along with a log file.
Blat "C:\Path\To\Log.txt" -to %EmailTo% -subject "Setup Complete"