【问题标题】:why does mailx ignore header fields?为什么 mailx 忽略标题字段?
【发布时间】:2018-07-12 01:10:16
【问题描述】:

我想发送一封 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 标志并指定内容类型,
但是我的mailx 版本上的-a 是附件;所以这是行不通的。

【问题讨论】:

    标签: linux email ubuntu mailx cl


    【解决方案1】:

    使用选项-t时,mailx会过滤掉标题字段,只保留以下字段:

    • to:
    • cc:
    • bcc:
    • from:
    • reply-to:
    • sender:
    • organization:

    任何其他标头都会产生"Ignoring header field" 警告消息并被丢弃。

    这在手册中实际上是神秘的。

    【讨论】:

      猜你喜欢
      • 2023-02-22
      • 2021-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多