不可或缺的 sendEmail
還在為Linux下沒有便捷的郵件程式苦惱,還在為複雜的郵件伺服器架設Google N多網頁? 對於小型,便捷的Linux下命令列郵件程式,sendEmail使得這一切變得輕鬆可行。一起來看看吧。
- 一、sendEmail介紹
- SendEmail is a lightweight, command line SMTP email client. If you have the need to send email from a command line, this
- free program is perfect: simple to use and feature rich. It was designed to be used in bash scripts, batch files, Perl
- programs and web sites, but is quite adaptable and will likely meet your requirements. SendEmail is written in Perl and is
- unique in that it requires NO MODULES. It has an intuitive and flexible set of command-line options, making it very easy to
- learn and use.
- SendEmail is licensed under the GNU GPL, either version 2 of the License or (at your option) any later version.
- [Supported Platforms: Linux, BSD, OS X, Windows 98, Windows NT, Windows 2000, & Windows XP]
- 總的來說sendEmail簡單,輕量級,命令列,可伸縮,跨平臺。
- 二、下載與安裝
- 下面的地址是sendEmail的下載及詳細說明
- 下面是安裝描述,總共四個步驟就搞定。
- ------------------
- Installation
- ------------------
- SendEmail is a perl script/program, and only needs to be copied to a directory
- in your path to make it accessible. Most likely the following steps will
- be sufficient:
- 1) Extract the package
- tar -zxvf sendEmail-v1.XX.tar.gz
- 2) Copy the sendEmail script to /usr/local/bin
- cp -a sendEmail-v1.XX/sendEmail /usr/local/bin
- 3) Make sure its executable
- chmod +x /usr/local/bin/sendEmail
- 4) Run it
- sendEmail
- or
- /usr/local/bin/sendEmail
- 三、用法
- 直接輸入sendEmail,將出現該工具的用法介紹,如下所示。由於用法也簡單明瞭,因此不一一解釋
- robin@SZDB:~/dba_scripts/sendEmail-v1.56> ./sendEmail
-
sendEmail-1.56 by Brandon Zehm
- Synopsis: sendEmail -f ADDRESS [options]
- Required:
- -f ADDRESS from (sender) email address
- * At least one recipient required via -t, -cc, or -bcc
- * Message body required via -m, STDIN, or -o message-file=FILE
- Common:
- -t ADDRESS [ADDR ...] to email address(es)
- -u SUBJECT message subject
- -m MESSAGE message body
- -s SERVER[:PORT] smtp mail relay, default is localhost:25
- Optional:
- -a FILE [FILE ...] file attachment(s)
- -cc ADDRESS [ADDR ...] cc email address(es)
- -bcc ADDRESS [ADDR ...] bcc email address(es)
- -xu USERNAME username for SMTP authentication
- -xp PASSWORD password for SMTP authentication
- Paranormal:
- -b BINDADDR[:PORT] local host bind address
- -l LOGFILE log to the specified file
- -v verbosity, use multiple times for greater effect
- -q be quiet (i.e. no STDOUT output)
- -o NAME=VALUE advanced options, for details try: --help misc
-
-o message-content-type=
- -o message-file=FILE -o message-format=raw
- -o message-header=HEADER -o message-charset=CHARSET
- -o reply-to=ADDRESS -o timeout=SECONDS
- -o username=USERNAME -o password=PASSWORD
-
-o tls=
-o fqdn=FQDN - Help:
- --help the helpful overview you're reading now
- --help addressing explain addressing and related options
- --help message explain message body input and related options
- --help networking explain -s, -b, etc
- --help output explain logging and other output options
- --help misc explain -o options, TLS, SMTP auth, and more
- 檢視詳細的幫助檔案,如下方式:
- ./sendEmail --help addressing
- ./sendEmail --help message
- 四、示例
- #傳送者使用任意的郵箱方式傳送郵件
- robin@SZDB:~> sendEmail -f robinson@oracle.com \
- > -t robinson.cheng@trade.com \
- > -u "Test Mail" \
- > -m "This is a test mail from Robinson"
- Dec 18 14:10:23 szdb sendEmail[18494]: Email was sent successfully!
- #傳送者使用一個真實存在的網際網路郵件伺服器來傳送郵件
- robin@SZDB:~> sendEmail -f rocket010824@163.com \
- > -t robinson.cheng@trade.com \
- > -u "Test Mail" \
- > -s smtp.163.com \
- > -xu jackson \
- > -xp temp_000 \
- > -m "This is test mail from Robinson"
- Dec 18 14:13:24 szdb sendEmail[18500]: Email was sent successfully!
- 傳送給多個郵件接收人
- robin@SZDB:~> sendEmail -f robinson@oracle.com \
-
> -t "Robinson cheng
" jackson@163.com \ - > -u "Send email to mutiple people" \
- > -m "This is a test mail"
- Dec 18 14:24:57 szdb sendEmail[18537]: Email was sent successfully!
- 使用抄送,密送接收人
- robin@SZDB:~> sendEmail -f robinson@oracle.com \
-
> -t "Robinson cheng
" \ - > -cc jason.wu@trade.com \
- > -bcc jackson@163.com \
- > -u "Test mail " \
- > -m "This is a test mail"
- 傳送帶有附件的郵件
- robin@SZDB:~> sendEmail -f robinson@oracle.com \
-
> -t "Robinson cheng
" \ - > -cc jason.wu@trade.com \
- > -u "Test mail with multi attached" \
- > -m "This is a test mail with multi attached" \
- > -a /users/robin/addmrpt_1_11584_11649.txt "/users/robin/Temp log"
- Dec 18 14:43:35 szdb sendEmail[18664]: Email was sent successfully!
- #使用檔案內容作為郵件的body
- robin@SZDB:~> sendEmail -f robinson@oracle.com \
-
> -t "Robinson cheng
" \ - > -u "Test mail and the body from file contents" \
- > -o message-file=/users/robin/addmrpt_1_11584_11649.txt
- Dec 18 14:50:39 szdb sendEmail[18715]: Email was sent successfully!
- robin@SZDB:~> cat addmrpt_1_11584_11649.txt | sendEmail -f robinson@oracle.com \
-
> -t "Robinson cheng
" \ - > -u "Test mail and the body from file contents"
- Reading message body from STDIN because the '-m' option was not used.
- If you are manually typing in a message:
- - First line must be received within 60 seconds.
- - End manual input with a CTRL-D on its own line.
- Dec 18 14:47:31 szdb sendEmail[18709]: Message input complete.
- Dec 18 14:47:31 szdb sendEmail[18709]: Email was sent successfully!
- #傳送郵件時讀取html檔案內容作為body
- robin@SZDB:~> sendEmail -f robinson@oracle.com \
-
> -t "Robinson cheng
" \ - > -u "HTML test mail" \
- > -o message-file=/users/robin/CNMMBO_awrrpt_1_20121218.html
- Dec 18 14:54:07 szdb sendEmail[18721]: Email was sent successfully!
- #Author :Robinson
- #Blog : http://blog.csdn.net/robinson_0612
- #傳送html郵件
- robin@SZDB:~> sendEmail -f robinson@oracle.com \
- > -t robinson.cheng@trade.com \
- > -u "This is an html test mail" \
- > -o message-content-type=html \
- > -m "The body is html format"
- Dec 18 15:19:36 szdb sendEmail[18883]: Email was sent successfully!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23490154/viewspace-1062428/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- sendEmail帶的引數AI
- 不可或缺的 Bash 別名
- 不可或缺的 IT 領導者的 7 大特質
- 微服務架構——不可或缺的註冊中心微服務架構
- GitHub 使用指南:開發者不可或缺的工具Github
- 分散式技術中不可或缺的分散式互斥方案分散式
- 直播平臺建設過程中不可或缺的推送功能
- 混音器:視訊會議錄製不可或缺的元件元件
- 製造業“上網”,核心技術不可或缺
- ASP.NET MVC不可或缺的部分——DI及其本質工作分析ASP.NETMVC
- Facebook遊戲再營銷(一):4項不可或缺的準備工作遊戲
- 電話機器人-AI生態鏈中不可或缺的一環機器人AI
- 訊息推送——產品運營不可或缺的使用者觸達方式
- 禪道專案管理軟體,敏捷開發團隊不可或缺的工具專案管理敏捷
- 印度廣告業——傳統媒體依舊不可或缺
- 2023年趨勢追蹤:礦業及金屬行業不可或缺的作用行業
- 為何業務報告對精益生產不可或缺?
- 為什麼產品思考是使用者體驗設計時所不可或缺的?
- PHP 程式設計師危機:PHPer 如何快速成長為不可或缺的技術人才?PHP程式設計師
- 摩杜雲:物件儲存與CDN,網際網路應用不可或缺的組合物件
- IBM攜手亞馬遜雲科技,共創"不可或缺"的客戶價值與體驗IBM亞馬遜
- 當中國市場終於不可或缺,遊戲中文化的程式還會困難嗎遊戲
- 騰訊互動娛樂副總裁崔曉春:藝術背後的技術不可或缺
- 美雲智數-iHR在企業中不可或缺,其幫助企業大力發展人力資源
- JavaScript的this的指向JavaScript
- lua的for的坑
- Element-UI的table表格的樣式的常用的操作UI
- 新的地方,新的工作,新的生活
- Spingboot的Shiro的配置boot
- SqlServer的with(nolock)的用法SQLServer
- kotlin的Gson的使用Kotlin
- 做人的道理的句子
- nuxt的代理的配置UX
- 我的新的旅程
- Idea的Spring的建立IdeaSpring
- 逝去的《我的暑假》
- A的女兒是B的女兒的媽媽,A是B的誰?
- 找對的方向,用對的方法,做好的方案
- MySQL 缺少主鍵的表的效能下降的原因MySql