linux上使用 sendmail 发送 html格式内容的 邮件

首先,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