Liam Delahunty: Home Tips Web Contact
Recommended laptop
under £500

Think I deserve a present? See my Amazon Wish List

Linux, send html email from command line

sending a HTML document via email (linux command line) so that it appears as HTML to the recipient.

Prepare your message body so that it does contain (in addition to the HTML body) the following mail header lines:

Subject: Subject
Content-Type: text/html; charset="us-ascii"
/* You can of course add more header lines if necessary. */

... your carefully crafted html content ...

You of course have to replace the To address and the subject line.

Save this as mail_html.html.

Use sendmail to send this message:

/usr/sbin/sendmail < mail_html.html

Share this!