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:

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

<html>
... your carefully crafted html content ...
</html>

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 address@example.com < mail_html.html

Share this!