新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Linux系統(tǒng)中使用命令發(fā)送郵件
Linux系統(tǒng)中如何通過命令行發(fā)送命令?管理服務(wù)器時我們經(jīng)常需要寫一些監(jiān)測腳本,然后在出問題的時候通過郵件來通知,接下來我們?yōu)榇蠹医榻B用最簡單的方式來實現(xiàn) Linux 發(fā)送郵件。

需求
本文使用Centos7操作系統(tǒng)。
需要有一個工作正常的郵件系統(tǒng)。本文將不介紹如何配置郵件服務(wù)器。
使用mail命令
安裝mailx安裝包
[root@localhost ~]# yum -y install mailx
安裝完成,我們可以使用下面發(fā)送帶附件的郵件:
[root@localhost ~]# echo "Message Body Here" | mail -s "Subject Here" user@example.com -a anaconda-ks.cfg
其中的-s:指定郵件主題。-a:添加附件。 也可以在文件中保存消息內(nèi)容,然后使用mail發(fā)送:
[root@localhost ~]# mail -s "Subject here" -t user@example.com -A anaconda-ks.cfg
使用mutt命令
安裝mutt安裝包:
[root@localhost ~]# yum -y install mutt
安裝完成,我們可以使用下面發(fā)送帶附件的郵件:
[root@localhost ~]# echo "Message Body Here" | mutt -s "Subject Here" -a anaconda-ks.cfg user@example.com
其中的-s:指定郵件主題。-a:添加附件。
總結(jié)
你是否有其他方法可以從Linux終端發(fā)送帶有附件的電子郵件?
當(dāng)前標(biāo)題:Linux系統(tǒng)中使用命令發(fā)送郵件
路徑分享:http://www.5511xx.com/article/dpccpcj.html


咨詢
建站咨詢
