linux邮件添加内容类型头不起作用

linux邮件添加内容类型头不起作用,linux,bash,shell,mailx,Linux,Bash,Shell,Mailx,我正在使用mail命令从我的linux系统发送邮件 我遇到的问题是邮件的内容类型总是内容类型:text/plain;字符集=美国ascii 我正在发送html内容,它显示为纯文本 这就是我尝试过的 1) body="From: me@example.org To: me@gmail.com Subject: MIME Test Mime-Version: 1.0 Content-Type: text/html <html> <body> This is a test.

我正在使用mail命令从我的linux系统发送邮件

我遇到的问题是邮件的内容类型总是
内容类型:text/plain;字符集=美国ascii

我正在发送html内容,它显示为纯文本

这就是我尝试过的

1)
body="From: me@example.org
To: me@gmail.com
Subject: MIME Test
Mime-Version: 1.0
Content-Type: text/html

<html>
<body>
This is a test.
</body>
</html>";

echo $body| mail -s "testing purpose" reciever@gmail.com
1)
body=“发件人:me@example.org
致:me@gmail.com
主题:默剧测试
Mime版本:1.0
内容类型:text/html
这是一个测试。
";
echo$body | mail-s“测试目的”reciever@gmail.com
这不管用

我将这个html放在$tempfile中一个名为test.html的文件中 试图这样执行

2)
邮件-a'MIME版本:1.0'-a'内容类型:text/html;字符集=iso-8859-1“服务器详细信息”receiver@gmail.com“<$tempfile
但是没有任何效果,请建议我(请仅使用mail而不是sendmail/mutt)。

试试看

echo "<b>HTML Message goes here</b>" | mail -s "$(echo -e "This is the subject\nContent-Type: text/html")" foo@example.com
echo“HTML消息在此显示”| mail-s“$(echo-e“这是主题内容类型:text/HTML”)”foo@example.com

echo "<b>HTML Message goes here</b>" | mail -s "$(echo -e "This is the subject\nContent-Type: text/html")" foo@example.com