Skip to content

Instantly share code, notes, and snippets.

@delputnam
Created January 5, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save delputnam/b44118c7974cd0b6643d to your computer and use it in GitHub Desktop.
Save delputnam/b44118c7974cd0b6643d to your computer and use it in GitHub Desktop.
Send an HTML email from the command line
You can do this relatively simple from the command line. Save your HTML, but also include the necessary SMTP headers at the top in the source. For this example I'll save the source as example.html in my home directory.
~/example.html:
From: sender@example.com
To: recipient@example.com
Subject: Test email
Mime-Version: 1.0
Content-Type: text/html
<html>
<body>
<p>Hello world!</p>
</body>
</html>
Now you can send this e-mail from Terminal.app by executing the following command:
cat ~/example.html | sendmail -t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment