Linux下使用sendEmail發送帶附件的郵件(轉載)

    轉載:http://www.ttlsa.com/linux/use-sendemail-send-file/php

sendEmail是一個輕量級,命令行的SMTP郵件客戶端。若是你須要使用命令行發送郵件,那麼sendEmail是很是完美的選擇:使用簡單而且功能強大.這個被設計用在php、bash、perl和web站點使用。
以上是sendEmail的簡單介紹,千萬不要和sendmail搞混掉了。用了sendEmail你將不在喜歡sendmail了.html

安裝sendEmaillinux

發送郵件git

#  /usr/local/bin/sendEmail -f ttlsafrom@163.com -t ttlsato@qq.com \
    -s smtp.163.com -u "我是郵件主題-發送附件" -o message-content-type=html \
    -o message-charset=utf8 -a /data/site/ttlsa.rar -xu ttlsafrom@163.com \
    -xp 123456 -m "我是郵件內容-詳見附件"

發送成功以後會有以下提示:
Jul 29 15:02:53 e10074 sendEmail[26347]: Email was sent successfully!github

命令說明:web

/usr/local/bin/sendEmail 命令主程序
-f ttlsafrom@163.com  發件人郵箱
-s smtp.163.com       發件人郵箱的smtp服務器
-u "我是郵件主題"     郵件的標題
-o message-content-type=html   郵件內容的格式,html表示它是html格式
-o message-charset=utf8        郵件內容編碼</pre>
-a /data/site/a.rar             發送ttlsa.rar這個文件
-xu ttlsafrom@163.com          發件人郵箱的用戶名
-xp 123456               發件人郵箱密碼
-m "我是郵件內容"        郵件的具體內容

 

github地址:https://github.com/mogaal/sendemailbash

126smtp服務器:smtp.126.com 端口號:25服務器

相關文章
相關標籤/搜索