linux - 为什么 mailx 忽略标题字段?

标签 linux email ubuntu mailx cl

我想发送一封 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/

    相关文章:

    linux - 将一个命令输出传递给另一个命令

    Linux 的 hrtimer - 微秒精度?

    ubuntu - 如何在 Ubuntu 18.04 的 PhpStorm 中设置 Super+comma 快捷方式?

    c - 有效的 UID 未按预期运行

    C switch 语句中的编译错误

    c++ - 在 Linux 上使用 g++ 链接静态英特尔 IPP 库时出现问题

    javascript - 在电子邮件的正文中发送 JSON 消息,字符串在中流中断

    python - SMTP 直接到主机的 MX 记录

    c# - 客户端 SendEmail-Method 不起作用

    linux - Bash 脚本在 WebDAV 中创建目录时失败