Linux邮件添加的内容类型头不工作 [英] linux mail adding content type headers not working

查看:116
本文介绍了Linux邮件添加的内容类型头不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用邮件命令从我的Linux系统发送邮件。

i am using mail command to send mails from my linux system.

我收到问题是邮件的内容类型,都为的Content-Type:text / plain的;字符集= US-ASCII

The problem i am getting is the Content type of the mail is always as Content-Type: text/plain; charset=us-ascii.

我发送的HTML内容,它会显示为纯文本。

I am sending the html content and it is displaying as plain text.

这是我曾尝试

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

这并没有工作

我把这个网站在一个称为test.html在$临时文件的文件
并试图执行这样

2)
mail -a 'MIME-Version: 1.0' -a 'Content-Type: text/html; charset=iso-8859-1' "server details" "receiver@gmail.com" < $tempfile

但没有奏效,请建议我对此(请仅用邮件不是sendmail的/傻子)。

But nothing has worked, please suggest me regarding this (please only using mail not sendmail/mutt).

推荐答案

尝试

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

如何使用Linux命令行发送HTML邮件

这篇关于Linux邮件添加的内容类型头不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆