由于部門老大做SVN的自動發送郵件,但是由于服務器是windows,雖然郵件客戶端很多,但是基于命令行的客戶端還是很少的,后面老大就找到了blat.exe這個軟件,由于他多次嘗試失敗,就讓我測試,經過測試,發現非常的簡單,功能挺強大,是一款很不錯的開源工具!
BLAT官網:http://www.blat.net/
采用版本:blat3217 (64位程序)
基本步驟:
(1)下載軟件,并對其設置環境變量,設置環境變量會有很多的好處,我們不必要糾結目錄問題;
(2)命令行blat
C:\Users\Administrator>blat Blat v2.7.6 w/GSS encryption (build : Oct 25 2011 21:12:01) Win32 console utility to send mail via SMTP or post to usenet via NNTP by P.Mendes,M.Neal,G.Vollant,T.Charron,T.Musson,H.Pesonen,A.Donchey,C.Hyde http://www.blat.net syntax: Blat <filename> -to <recipient> [optional switches (see below)] Blat -SaveSettings -f <sender email addy> -server <server addr> [-port <port>] [-try <try>] [-profile <profile>] [-u <login id>] [-pw <password>] or Blat -install <server addr> <sender's addr> [<try>[<port>[<profile>]]] [-q] Blat -profile [-delete | "<default>"] [profile1] [profileN] [-q] Blat -h
基本就是兩步,第一步一個簡單的注冊,第二部就可以發送郵件
C:\Users\Administrator>blat -install smtp.*******.com ***@wi****.com 3 25
發送命令:
C:\Users\Administrator>blat c:\www.txt -to 18**@163.com -u **@wi***.com -pw ***** -charset Gb2312
Blat v3.2.17 (build : Aug 10 2016 22:32:51)
64-bit Windows, Full, Unicode
Sending c:\www.txt to 18***@163.com
Subject: Contents of file: www.txt
Login name is ****@wi****.com
Try number 1 of 3.
以下部分我們未用到,但是感覺不錯所以就收集了,
http://jfxwc.blog.163.com/blog/static/650205020105544357851/
批命令例子:
----------------- 例子開始 -----------------------------------------
@echo off
:::::::::::::: 參數設置::::::::::::::
set from=xxx@163.com
set user=xxx
set pass=xxx
set to=xxx@163.com
set subj=測試
set mail=mail_body.txt
set server=smtp.163.com
set attach=attach.rar
set debug=-debug -log blat.log -timestamp
::::::::::::::::: 運行blat :::::::::::::::::
rem blat %mail% -to %to% -base64 -charset Gb2312 -subject %subj% -server %server% -f %from% -u %user% -pw %pass% -attach %attach% %debug%
----------------- 例子結束 -----------------------------------------
經過測試,中文內容沒有問題(注意源文件的編碼),支持 163 之類的系統,
mail_body.txt : 正文
attach.rar : 附件
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。