用 cmd 去寄信:
mail -s"Subject header" -r"recipient" <"file" <--- mailx
sendmail -f"from name" "recipient" <"file"
heirloom-mailx
apt-get install heirloom-mailx
Usage:
mail <opts> recipient
opts:
-a FILE
Attach the given file to the message.
-c address
Send carbon copies to list of users
-q file
Start the message with the contents of the specified file. (-q 與 file 間一定要有空榕)
-r address
Sets the From address.
recipient = "," 分隔的 list
example:
echo "" | mail -s"Daily e-mail report" -a"/root/mail_report.txt" -q "/root/script/mail_report_context.txt" [email protected]