linux本地常見郵件服務有: Centos5:預設使用sendmail郵件服務,開啟方式/etc/init.d/sedmail start Centos6:預設使用postfix郵件服務,開啟方式/etc/init.d/postfix start 搭建郵件服務: 在/etc/mail.rc最後一行 ...
linux本地常見郵件服務有:
Centos5:預設使用sendmail郵件服務,開啟方式/etc/init.d/sedmail start
Centos6:預設使用postfix郵件服務,開啟方式/etc/init.d/postfix start
搭建郵件服務:
在/etc/mail.rc最後一行輸入一下內容即可
set [email protected] smtp=smtp.163.com [email protected] smtp-auth-password=123456 smtp-auth=login
其中分別表示:
郵件地址:set [email protected]
郵件伺服器:smtp=smtp.163.com
用戶名: [email protected]
密碼:smtp-auth-password=123456
認證方式:smtp-auth=login
MAIL參數詳情:
-i :忽略tty的終斷訊號。
-l :強迫設置成互動模式。
-v :列出發送的地點、狀態、信息
-n :不讀入/etc/mail.rc設定的文檔
-s :郵件標題
-c :cc抄送郵件地址
-b :bcc密送郵件地址(需要啟用其中服務,sendmail服務、qmail服務、posfix服務)
系統收到郵件都會預設保存在/var/spool/mail/目錄下,在命令行中輸入mail就會預設顯示郵件預設(20條),此時命令提示
符為"&":
unread :標記為未讀郵件
h(headers) :顯示當前的郵件列表
l(list) :顯示當前支持的命令列表
?(help) :顯示多個查看郵件列表的命令參數及用法
d(delete) :刪除當前郵件,指針並下移。 d 1-100刪除1到100封郵件
f(from) :值顯示當前郵件的簡易信息。f mum指針移動到該郵件並顯示該郵件的簡易信息
z :顯示剛進行收件箱時的後面二十封郵件列表
郵件發送語法:1、echo "Hello World" |mail -s test [email protected] #直接輸送過去
2、mail -s test [email protected] #回車後在裡邊輸入相應的內容然後crtrl+d發送
3、mail -s test [email protected] <file #發送文本中的內容