使用blat在命令行下发送邮件

来源:互联网 发布:excel解密码软件 编辑:程序博客网 时间:2024/04/20 07:58

Blat is a Windows (32 & 64 bit) command line utility that sends eMail using SMTP or post to usenet using NNTP

官网:http://www.blat.net/

我使用的版本:3.2.17,64位

下面是自用的一个bat脚本:邮件的body使用的是html而不是txt,因为使用html可以加入超链接。

test.bat

rem [send email]set blatPath="C:\Program Files (x86)\blat\blat.exe"set tflist="C:\test\tf.txt"set cflist="C:\test\cf.txt"set body="C:\test\body.html"@echo ******SendEmail Start %date% %time%******rem [发送邮箱]set from=zhangcan@163.comrem [发送账号]set user=zhangcanrem [发送密码] set pass=12345678rem [接收账号]set tf=%tflist%rem [抄送账号]set cf=%cflist%rem [邮件标题]set subject="这是封测试邮件"rem [邮件内容]set content=%body%rem [发送邮件的服务器]set server=smtp.163.comrem [开始发送]%blatPath% %content%  -html -tf %tf% -cf %cf% -subject %subject% -server %server% -f %from% -u %user% -pw %pass%@echo ******SendEmail Finished %date% %time%******pause

tf.txt

302877286@qq.comhuangxue@163.com
cf.txt

302982009@qq.comzhangcan2@163.com

body.html

<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312">    <title>Aeromind Windows打包日志</title></head><body leftmargin="8" marginwidth="50" topmargin="8" marginheight="24" offset="0"><table width="95%" cellpadding="0" cellspacing="0" style="font-size: 17pt; font-family: Tahoma, Arial, Helvetica, sans-serif">    <tr>        <td>(本邮件由灿哥哥自动下发,请勿回复!)</td>    </tr>    <tr>   test安装包下载        <td>            <ul>                <li>新的桌面端安装包已打包成功</li>                <li>当前安装包名称:test</li>                <li>安装包版本:1.0.0</li>                 <li>新的安装包下载链接:<a href="http://www.baidu.com">点击下载</a></li>             </ul>        </td>    </tr>    <hr size="2" width="100%" align="center"></table></body></html>

下图是zhangcan2@163.com接收到的邮件




原创粉丝点击