Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Linux mail 指令實戰範例:寄送標題內容、多收件人、自訂寄件人、附件與回覆地址

編輯:關於 Linux

mail 是系統管理員常用的郵件發送工具,支援豐富參數。本文透過實例示範常見發送場景。

參數速查

mail -s "主題" -r "寄件人" -R "回覆信箱" -a "附件路徑" 收件人1 收件人2 ...

實例演示

1. 基本發送 (互動輸入內容,Ctrl+D 結束)

mail -s "this is a title" bbmonkey62@163.com
this is content
EOT

2. 多收件人

mail -s "title" bbmonkey62@163.com admin@163.com

3. 自訂寄件人 (隱藏真實帳號)

mail -s "title" -r "myname@zihou.me" bbmonkey62@163.com

4. 自訂回覆地址

mail -s "title" -r "myname@zihou.me" -R "myreply@zihou.me" bbmonkey62@163.com

5. 發送附件

mail -s "title" -r "myname@zihou.me" -a "/home/hadoop/report/3.txt" bbmonkey62@163.com

掌握這些參數,即可在腳本中自動化發送監控報警、備份報告等郵件。

Copyright © Windows教程網 All Rights Reserved