首先,Linux 上配置安裝mailx 或 postfix 軟件。
然后使用 mailx 或 sendmail 發郵件。
linux上使用 sendmail 發送 html格式內容的 郵件
(
echo "To: lipeng20004@126.com"
echo "Subject: The Subject"
echo "Content-Type: text/html"
echo
cat ./part.html
) | sendmail -t
linux上 mailx 發郵件測試
mailx -s "$(echo -e "subject\nContent-Type: text/html; charset=utf-8")" lipeng20004@126.com < part.html
mailx -s "$(echo -e "subject\nContent-Type: text/html; Charset=GB2312")" lipeng20004@126.com < part.html
echo "ttt" | mailx -s "email title: test mail" lipeng20004@126.com