4

Linux システムからメールを送信するためにmailコマンドを使用しています。

私が得ている問題は、メールのコンテンツタイプが常にContent-Type: text/plain; charset=us-ascii.

HTMLコンテンツを送信していますが、プレーンテキストとして表示されています。

これは私が試したものです

1)
body="From: me@example.org
To: me@gmail.com
Subject: MIME Test
Mime-Version: 1.0
Content-Type: text/html

<html>
<body>
This is a test.
</body>
</html>";

echo $body| mail -s "testing purpose" reciever@gmail.com

これはうまくいきませんでした

このhtmlを$tempfileのtest.htmlというファイルに入れ、このように実行しようとしました

2)
mail -a 'MIME-Version: 1.0' -a 'Content-Type: text/html; charset=iso-8859-1' "server details" "receiver@gmail.com" < $tempfile

これについて私に提案してください (sendmail/mutt ではなくメールのみを使用してください)。

4

1 に答える 1

7

試す

echo "<b>HTML Message goes here</b>" | mail -s "$(echo -e "This is the subject\nContent-Type: text/html")" foo@example.com

Linuxコマンドラインを使用してHTMLメールを送信する方法

于 2014-03-17T15:13:32.783 に答える