姬長信(Redy)

Mailx发送html消息


参见英文答案 > Sending HTML mail using a shell script????????????????????????????????????11个
>????????????How do I send a file as an email attachment using Linux command line?????????????????????????????????????26个
我想用Mailx发送一条HTML消息.当我尝试以下命令时
mailx -s "Subject"  user@gmail.com  

我以纯文本格式获取了email.html的内容.在消息中,标题Content-Type设置为text / plain. -a选项尝试发送文件,因此我没有找到如何修改标头.这个answer几乎可以工作,它将Content-Type设置为text / html,但不能替换默认的Content-Type,即text / plain.

mailx -s "$(echo -e "This is the subject/nContent-Type: text/html")" user@gmail.com  

给出了这个结果:

From: send@gmail.com
To: user@gmail.com
Subject: This is the subject
Content-Type: text/html
Message-ID: 
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
 boundary="=_538d7b66.z5gaIQnlwb1f/AOkuuC+GwF1evCaG/XIHQMbMMxbY6satTjK"

This is a multi-part message in MIME format.

--=_538d7b66.z5gaIQnlwb1f/AOkuuC+GwF1evCaG/XIHQMbMMxbY6satTjK
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline



Helo wolrd

PS:我也试过用uuencode.当我尝试在网络邮件中显示消息时,我得到一个空白页面…