Mailx で html メッセージを送信したい。次のコマンドを試すと
mailx -s "Subject" user@gmail.com < email.html
email.html の内容をプレーンテキストで取得します。メッセージでは、ヘッダー Content-Type が text/plain に設定されています。-a オプションはファイルを送信しようとするため、ヘッダーを変更する方法がわかりませんでした。この回答はほとんど機能しました。Content-Type を text/html に適切に設定しますが、デフォルトの Content-Type である text/plain を置き換えません。
mailx -s "$(echo -e "This is the subject\nContent-Type: text/html")" user@gmail.com < email.html
この結果が得られます:
From: send@gmail.com
To: user@gmail.com
Subject: This is the subject
Content-Type: text/html
Message-ID: <538d7b66.Xs0x9HsxnJKUFWuI%maikeul06@gmail.com>
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
<html>
<body>
<p>Helo wolrd</p>
</body>
</html>
PS : uuencode も試しました。Webメールでメッセージを表示しようとすると、空白のページが表示されます...