How do I send mail from linux command line so it appears as HTML to recipient?
I've tried emailing a normal web page using something like:
mail -s "Test Email" [email protected] < webpage.htm
However, the recipient sees the raw HTML tags in the email and none of my careful formatting. Am using RedHat Linux.
Solution 1:
You need to tell the MUA that the content contains HTML. Traditionally this is done using MIME. Try adding the following header lines to your message:
Mime-Version: 1.0
Content-Type: text/html
You may need to add a Content-Transfer-Encoding header as well. The Wikipedia page on MIME has more details, including links to relevant RFCs.
Update: This worked fine when piped into sendmail -t
:
From: [email protected]
To: [email protected]
Subject: MIME Test
Mime-Version: 1.0
Content-Type: text/html
<html>
<body>
This is a test.
</body>
</html>
Solution 2:
Solucion a envio html
mail -a 'MIME-Version: 1.0' -a 'Content-Type: text/html; charset=iso-8859-1' -a 'X-AUTOR: Ing. Gareca' -s 'MTA STATUS: mail queue' [email protected] -- -f [email protected] < /tmp/eximrep.html
Solution 3:
it is not possible with mail
afaik. But here is a short how-to with sendmail.