why does mailx ignore header fields?
Asked Answered
K

1

8

I want to send an HTML email.
have a plain text file that looks like this:

From: "name" <[email protected]>
To: [email protected]
Subject: First Email
MIME-Version: 1.0
Content-Type: text/html; charset=us-ascii
Content-Disposition: inline

<strong>Hello, World!</strong>

I run mailx like this,

mailx -t -S smtp=server.com [email protected]  < file

It sends a plain-text email instead and prints:

Ignoring header field "MIME-Version: 1.0"
Ignoring header field "Content-Type: text/html; charset=us-ascii"
Ignoring header field "Content-Disposition: inline"

Why?
How do I send an html email?

Other sources say to use the -a flag and specify the content-type,
but -a on my version of mailx is attachment; so that doesn't work.

Koontz answered 1/2, 2018 at 16:22 Comment(0)
G
1

When using option -t, mailx filters out header fields and only keeps the following ones:

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

Any other header produces the "Ignoring header field" warning message and is discarded.

This is effectively cryptic in the manual.

Gilus answered 30/4, 2020 at 23:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.