我想发送一封 HTML 电子邮件。
有一个如下所示的纯文本文件:
From: "name" <name@email.com>
To: name@email.com
Subject: First Email
MIME-Version: 1.0
Content-Type: text/html; charset=us-ascii
Content-Disposition: inline
<strong>Hello, World!</strong>
我跑
mailx
像这样,mailx -t -S smtp=server.com name@email.com < file
它改为发送纯文本电子邮件并打印:
Ignoring header field "MIME-Version: 1.0"
Ignoring header field "Content-Type: text/html; charset=us-ascii"
Ignoring header field "Content-Disposition: inline"
为什么?
如何发送 html 电子邮件?
其他消息来源说使用
-a
标记并指定内容类型,但是
-a
在我的 mailx
版本上是附件;所以这是行不通的。
最佳答案
使用选项 -t
时, mailx 过滤掉标题字段,只保留以下字段:
to:
cc:
bcc:
from:
reply-to:
sender:
organization:
任何其他标题都会产生 "Ignoring header field"警告消息并被丢弃。
这在手册中实际上是神秘的。
关于linux - 为什么 mailx 忽略标题字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48567335/