------------------------
Blat - A Windows (32 & 64 bit) command line SMTP mailer.
一款支持windows cmd(bat)命令行下利用SMTP发送邮件的工具;
Use it to automatically eMail logs, the contents of a html FORM, or whatever else you need to send.
它可以自动发送邮件,邮件内容支持自定义,也支持html格式;
------------------------
------------------------
------------------------
Blat -body "test mailtest mailtest mailtest mailtest mailtest mailtest mailtest mailtest mailtest mailtest mailtest mailtest mailtest mailtest mailtest mailtest mail" -s "测试test" -t nn1183@qq.com -server smtp.qq.com -f 442624872@qq.com -u 442624872@qq.com -pw hacrtlypjdracada
邮件内容:test mail ;邮件主题:测试test ;收件人:n1183@qq.com ;发件人服务器:smtp.qq.com ;发件人:442624872@qq.com ; 账号:442624872@qq.com ; 密码:lcgcaflcjewvb;更多功能在这行命令的基础上去优化完善即可;
------------------------
优化:把所有的值变量变量
------------------------
set body="test mail"
set s="测试test"
set t=nn1183@qq.com
set f=442624872@qq.com
set pw=hacrtlypjdracada
Blat -body %body% -s %s% -t %t% -server smtp.qq.com -f %f% -u %f% -pw %pw%
------------------------
优化:加注释
------------------------
rem ----邮件内容-----
set body="test mail"
rem ----邮件主题----
set s="测试test"
rem ----收件邮箱-----
set t=nn1183@qq.com
rem ----发件邮箱-----
set f=442624872@qq.com
rem ----邮箱秘钥-----
set pw=hacrtlypjdracada
rem ----执行发送-----
Blat -body %body% -s %s% -t %t% -server smtp.qq.com -f %f% -u %f% -pw %pw%
------------------------
优化:写日志并了解报错;
------------------------
set name=%date:~0,4%%date:~5,2%%date:~8,2%
mail.bat >>%name%.log
------------------------
优化:加附件
-attach
------------------------
rem ----邮件内容-----
set body="test mail"
rem ----邮件主题----
set s="测试test"
rem ----收件邮箱-----
set t=nn1183@qq.com
rem ----发件邮箱-----
set f=442624872@qq.com
rem ----邮箱秘钥-----
set pw=hacrtlypjdracada
rem ----附件-----
set attach="1.txt,1.7z"
rem ----执行发送-----
Blat -body %body% -s %s% -attach %attach% -t %t% -server smtp.qq.com -f %f% -u %f% -pw %pw%
------------------------
优化:文件内容从文件中取
Blat
------------------------
rem ----邮件内容-----
set body="1.txt"
rem ----邮件主题----
set s="测试test"
rem ----收件邮箱-----
set t=nn1183@qq.com
rem ----附件-----
set attach="1.txt"
rem ----发件邮箱-----
set f=442624872@qq.com
rem ----邮箱秘钥-----
set pw=hacrtlypjdracada
rem ----执行发送-----
Blat %body% -s %s% -attach %attach% -t %t% -server smtp.qq.com -f %f% -u %f% -pw %pw%
----------------------------------------------------
开机自动发邮件
----------------------------------------------------
set name=%date:~0,4%%date:~5,2%%date:~8,2%
set namet=%time:~0,2%%time:~3,2%%time:~6,2%
rem ----邮件内容-----
set body="%name%%time%您的电脑被开机请知悉"
rem ----邮件主题----
set s="%name%%namet%电脑开机"
rem ----收件邮箱-----
set t=nn1183@qq.com
rem ----发件邮箱-----
set f=442624872@qq.com
rem ----邮箱秘钥-----
set pw=hacrtlypjdracada
rem ----执行发送-----
Blat -body %body% -s %s% -t %t% -server smtp.qq.com -f %f% -u %f% -pw %pw%
------------------------
设置关机启动脚本
------------------------
1.开始——运行——gpedit.msc
2.策略——计算机配置——Windows设置——脚本(启动/关机)
3.右击"关机"
4.添加——浏览:选择脚本确定;
5.完成设置,重启测试。
注:关机脚本启动目录:C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown\
----------------------------------------------------
学习本视频对您有价值,请给个五分好评吧以资鼓励。