1. 程式人生 > >windows平臺下通過blat傳送郵件用法小結

windows平臺下通過blat傳送郵件用法小結

在linux平臺的命令列下可以使用mail命令來發送郵件,windows平臺沒有內建的命令,但可以使用開源的 blat,其官方主頁為 http://www.blat.net/

blat的使用非常簡單,僅需兩步

1.使用 "blat -install <server addr> <sender's addr>"進行傳送郵件伺服器的配置

2.使用 "blat -to <recipient> -subject <subject name> -body <body content> -attach a.txt,b.xls"傳送郵件

示例:

有些smtp可能要求進行使用者驗證,如qq郵箱,則使用如下命令配置blat

blat -install smtp.qq.com [email protected] -u 123456 -pw mypassword

直接使用某個檔案的內容作為郵件正文

blat aa.txt -to [email protected] -subject "My first blat email"

更詳細的關於blat的說明

Blat v2.5.0 w/GSS encryption (build : Sep 14 2005 22:46:29)


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 -install <server addr> <sender's addr> [<try>[<port>[<profile>]]] [-q]
  Blat -profile [-delete | "<default>"] [profile1] [profileN] [-q]
  Blat -h

-------------------------------- Installation ---------------------------------
-install[SMTP|NNTP|POP3] <server addr> <sender's email addr> [<try n times>
                [<port> [<profile> [<username> [<password>]]]]]
                : set server, sender, number of tries and port for profile
                  (<try n times> and <port> may be replaced by '-')
                  port defaults are SMTP=25, NNTP=119, POP3=110
                  default profile can be specified with a '-'
                  username and/or password may be stored to the registry
                  order of options is specific
                  use -installNNTP for storing NNTP information
                  use -installPOP3 for storing POP3 information
                      (sender and try are ignored, use '-' in place of these)

--------------------------------- The Basics ----------------------------------
<filename>      : file with the message body to be sent
                  if your message body is on the command line, use a hyphen (-)
                  as your first argument, and -body followed by your message
                  if your message will come from the console/keyboard, use the
                  hyphen as your first argument, but do not use -body option.
-of <file>      : text file containing more options (also -optionfile)
-to <recipient> : recipient list (also -t) (comma separated)
-tf <file>      : recipient list filename
-cc <recipient> : carbon copy recipient list (also -c) (comma separated)
-cf <file>      : cc recipient list filename
-bcc <recipient>: blind carbon copy recipient list (also -b)
                  (comma separated)
-bf <file>      : bcc recipient list filename
-maxNames <x>   : send to groups of <x> number of recipients
-ur             : set To: header to Undisclosed Recipients if not using the
                  -to and -cc options
-subject <subj> : subject line, surround with quotes to include spaces(also -s)
-ss             : suppress subject line if not defined
-sf <file>      : file containing subject line
-body <text>    : message body, surround with quotes to include spaces
-sig <file>     : text file containing your email signature
-tag <file>     : text file containing taglines, to be randomly chosen
-ps <file>      : final message text, possibly for unsubscribe instructions

----------------------------- Registry overrides ------------------------------
-p <profile>    : send with server, user, and port defined in <profile>
                : use username and password if defined in <profile>
-profile        : list all profiles in the Registry
-server <addr>  : specify SMTP server to be used (optionally, addr:port)
-serverSMTP <addr>
                : same as -server
-serverNNTP <addr>
                : specify NNTP server to be used (optionally, addr:port)
-serverPOP3 <addr>
                : specify POP3 server to be used (optionally, addr:port)
                  when POP3 access is required before sending email
-f <sender>     : override the default sender address (must be known to server)
-i <addr>       : a 'From:' address, not necessarily known to the server
-port <port>    : port to be used on the SMTP server, defaults to SMTP (25)
-portSMTP <port>: same as -port
-portNNTP <port>: port to be used on the NNTP server, defaults to NNTP (119)
-portPOP3 <port>: port to be used on the POP3 server, defaults to POP3 (110)
-u <username>   : username for AUTH LOGIN (use with -pw)
-pw <password>  : password for AUTH LOGIN (use with -u)
-pu <username>  : username for POP3 LOGIN (use with -ppw)
-ppw <password> : password for POP3 LOGIN (use with -pu)

---------------------- Miscellaneous RFC header switches ----------------------
-organization <organization>
                : Organization field (also -o and -org)
-ua             : include User-Agent header line instead of X-Mailer
-x <X-Header: detail>
                : custom 'X-' header.  eg: -x "X-INFO: Blat is Great!"
-noh            : prevent X-Mailer/User-Agent header from showing Blat homepage
-noh2           : prevent X-Mailer header entirely
-d              : request disposition notification
-r              : request return receipt
-charset <cs>   : user defined charset.  The default is ISO-8859-1
-a1 <header>    : add custom header line at the end of the regular headers
-a2 <header>    : same as -a1, for a second custom header line
-dsn <nsfd>     : use Delivery Status Notifications (RFC 3461)
                  n = never, s = successful, f = failure, d = delayed
                  can be used together, however N takes precedence
-hdrencb        : use base64 for encoding headers, if necessary
-hdrencq        : use quoted-printable for encoding headers, if necessary
-priority <pr>  : set message priority 0 for low, 1 for high

----------------------- Attachment and encoding options -----------------------
-attach <file>  : attach binary file(s) to message (filenames comma separated)
-attacht <file> : attach text file(s) to message (filenames comma separated)
-attachi <file> : attach text file(s) as INLINE (filenames comma separated)
-embed <file>   : embed file(s) in HTML.  Object tag in HTML must specify
                  content-id using cid: tag.  eg: <img src="cid:image.jpg">
-af <file>      : file containing list of binary file(s) to attach (comma
                  separated)
-atf <file>     : file containing list of text file(s) to attach (comma
                  separated)
-aef <file>     : file containing list of embed file(s) to attach (comma
                  separated)
-base64         : send binary files using base64 (binary MIME)
-uuencode       : send binary files UUEncoded
-enriched       : send an enriched text message (Content-Type=text/enriched)
-unicode        : message body is in 16- or 32-bit Unicode format
-html           : send an HTML message (Content-Type=text/html)
-alttext <text> : plain text for use as alternate text
-alttextf <file>: plain text file for use as alternate text
-mime           : MIME Quoted-Printable Content-Transfer-Encoding
-8bitmime       : ask for 8bit data support when sending MIME
-multipart <size>
                : send multipart messages, breaking attachments on <size>
                  KB boundaries, where <size> is per 1000 bytes
-nomps                : do not allow multipart messages

---------------------------- NNTP specific options ----------------------------
-groups <usenet groups>
                : list of newsgroups (comma separated)

-------------------------------- Other options --------------------------------
-h              : displays this help (also -?, /?, -help or /help)
-q              : suppresses all output to the screen
-debug          : echoes server communications to a log file or screen
                  (overrides -q if echoes to the screen)
-log <file>     : log everything but usage to <file>
-timestamp      : when -log is used, a timestamp is added to each log line
-ti <n>         : set timeout to 'n' seconds.  Blat will wait 'n' seconds for
                  server responses
-try <n times>  : how many times blat should try to send (1 to 'INFINITE')
-binary         : do not convert ASCII | (pipe, 0x7c) to CrLf in the message
                  body
-hostname <hst> : select the hostname used to send the message via SMTP
                  this is typically your local machine name
-raw            : do not add CR/LF after headers
-delay <x>      : wait x seconds between messages being sent when used with
                  -maxnames or -multipart
-comment <char> : use this character to mark the start of commments in
                  options files and recipient list files.  The default is ;
-superdebug     : hex/ascii dump the data between Blat and the server
-superdebugT    : ascii dump the data between Blat and the server
-------------------------------------------------------------------------------

Note that if the '-i' option is used, <sender> is included in 'Reply-to:'
and 'Sender:' fields in the header of the message.

Optionally, the following options can be used instead of the -f and -i
options:

-mailfrom <addr>   The RFC 821 MAIL From: statement
-from <addr>       The RFC 822 From: statement
-replyto <addr>    The RFC 822 Reply-To: statement
-returnpath <addr> The RFC 822 Return-Path: statement
-sender <addr>     The RFC 822 Sender: statement

For backward consistency, the -f and -i options have precedence over these
RFC 822 defined options.  If both -f and -i options are omitted then the
RFC 821 MAIL FROM statement will be defaulted to use the installation-defined
default sender address.


相關推薦

windows平臺通過blat傳送郵件用法小結

在linux平臺的命令列下可以使用mail命令來發送郵件,windows平臺沒有內建的命令,但可以使用開源的 blat,其官方主頁為 http://www.blat.net/ blat的使用非常簡單,僅需兩步 1.使用 "blat -install <server

Windows 平臺局域網劫持測試工具 – EvilFoca

百度 baidu small 狀態 wlan wireshark 下載鏈接 tails 學習 簡介 安全測試工具可能含有攻擊性,請謹慎適用於安全教學及學習用途,禁止非法利用! EvilFoca是Windows環境下基於.NET FrameWork的一款輕量級的劫持測試工具。

Windows平臺搭建MySQL數據庫

最新 mysql\ list com 計算機相關 環境 download clas ice 1、下載安裝MySQL數據庫: (1)->我的標簽->軟件下載->計算機相關專業所用軟件---百度雲鏈接下載->mysql-installer-communi

windows平臺安裝與配置mysql5.7

mysql windows 博主QQ:819594300博客地址:http://zpf666.blog.51cto.com/有什麽疑問的朋友可以聯系博主,博主會幫你們解答,謝謝支持!在windows上安裝mysql5.7需要具有系統的管理員權限。Windows平臺下提供兩種安裝方式:1、mysql二進

windows平臺利用Nginx做負載均衡

htm oot 部署 top proxy rec cnblogs access cast 1.下載nginx(http://nginx.org/en/download.html)安裝包,解壓,並使用cmd命令轉到nginx.exe所在的目錄 2.執行cmd命令start n

【翻譯自mos文章】Windows平臺的 Oraagent Memory Leak

style date any pat trac bytes issue processes ren 來源於: Oraagent Memory Leak (文檔 ID 1956840.1) APPLIES TO: Oracle Database - Ent

Windows平臺將項目提交到Github上

keys tin 本地文件 ash ucc ast 生成 use pub 1.git安裝完成後,在開始菜單裏找到“Git”->“Git Bash”,一個類似命令行窗口的東西,初始設置msysgit,很簡單兩條命令即可搞定: git config --global us

Windows平臺結合 tortoiseSVN 和 VisualSVN Server 搭建SVN服務器並實現 web 站點同步

tar 效果 sql services 文檔 src 版本 att file 1. tortoiseSVN 關於 tortoiseSVN 的安裝使用詳見博文 TortoiseSVN的安裝及其簡單使用。 2. VisualSVN Server 關於 VisualS

libviso2在windows平臺的使用

this .cpp html ica 應用 sprint 地面 部分 github LIBVISO2簡介 libviso2 (Library for Visual Odometry 2) 是一個快速跨平臺C++庫用於計算移動單目/雙目相機的6DoF運動。 雙目版本基於最

kettle的下載、安裝和初步使用(windows平臺)(圖文詳解)

1.0 index java_home 網站 int 目錄 解決辦法 for sql kettle的下載   ?Kettle可以在http://kettle.pentaho.org/網站下載 http:

telnet通過smtp傳送郵件

////////////////////////////////////CMD指令////////////////////////////////////////////// cmd telnet smtp.163.com 25   or &nb

redis在windows平臺啟動出錯

  Redis官方是不支援windows的,如果想要下載,可以去這裡下載 下載地址:https://github.com/MicrosoftArchive/redis/releases Redis 支援 32 位和 64 位,這個需要根據你係統平臺的實際情況選擇。 這裡我下載的是redis-

通過javamailsenderimpl傳送郵件

參考文章:http://blog.csdn.net/qq_33556185/article/details/51028952 import javax.mail.internet.MimeMessage; import org.springframework.beans.factory.anno

Redis - Windows平臺怎麽切換db並且清理數據

redis-cli lec 輸入 ase 切換 database 其他 ref 空間 Redis 本身支持16個數據庫(0~15),通過 數據庫id 設置,默認為0。在Windows平臺下可以通過啟動redis-cli.exe來進入客戶端,客戶端默認連接數據庫0,在客戶端裏

Redis - Windows平臺怎麼切換db並且清理資料

Redis 本身支援16個數據庫(0~15),通過 資料庫id 設定,預設為0。在Windows平臺下可以通過啟動redis-cli.exe來進入客戶端,客戶端預設連線資料庫0,在客戶端裡可以輸入各種命令。 增加db數量 可以通過修改配置來增加Redis的db數量。在Windows平臺下,開啟redis.

1.3windows cmd批處理命令列使用blat郵件簡潔模板

rem ----郵件內容-----set body="test mail" rem ----郵件主題----set s="測試test"rem ----收件郵箱-----set [email protected]rem ----發件郵箱-----set [email protected]r

1.3windows cmd批處理命令行使用blat郵件簡潔模板

使用 serve 處理 命令行 mail 郵件內容 下使用 -- window rem ----郵件內容-----set body="test mail" rem ----郵件主題----set s="測試test"rem --

1.3windows命令列使用blat郵件帶附件

windows命令列bat批處理指令碼的應用之blat程式自動發郵件1.3windows命令列下使用blat發郵件帶附件__遊旗丶引莫(孫忠) 發郵件指令碼模板 rem ----郵件內容-----set body="test mail" rem ----郵件主題----set s="測試test"

1.3windows命令行使用blat郵件帶附件

rem cad 郵件 rac href mtp -s com flag windows命令行bat批處理腳本的應用之blat程序自動發郵件1.3windows命令行下使用blat發郵件帶附件__遊旗丶引莫(孫忠) 發郵件腳本模板 rem ----郵件內容-----se

windows平臺建立HTTP站點及FTP伺服器站點

基於win平臺下搭建一個ftp,或http伺服器站點,可以方便的實現檔案共享。 比如FTP站點: 基於視窗的訪問:ftp://192.168.1.202/   基於web的訪問:   HTTP站點訪問: