hail

hail sends html emails from the command line

For the impatient

It’s written in python and it works like mail. Download it, rename it hail and type hail --help.

A Brief History

Back in the dark ages, people used a program called mail to read and send electronic mail. mail was pretty sweet for it’s time, the man page calls it an intelligent mail processing system. It lets you read your incoming mail (but not paginate it), and also can compose outbound mail (but no editing, once you typed the line you either sent it or started over) using nothing more than an account on a VAX-11/780 and a VT100 terminal. This was back before graphics were invented, and when unix programs did one thing well, and that’s it. If you wanted to edit your message before you sent it, you fired up vi and edited a text file, then piped that file into mail to send it. No address book. No spam. Nothing fancy.

Today, there are lots of *nix machines that don’t even have mail installed. However, I still occasionally have a need to send emails from the command line, and mail works fine. Except for one thing. It can’t send HTML formatted messages.

hail works kinda like mail, except it can send HTML formatted messages. Oh yeah, and hail doesn’t read mail. There, I broke Jamie Zawinski’s Law of Software Envelopment which states:

Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.

For all you kids out there who have never heard of Jamie Zawinski, he worked at Mosiac Communications Corporation and wrote the unix version of Netscape (which later became Netscape Navigator and which is now Mozilla Firefox) back when Windows was still a 16 bit OS. And yes, he was the guy who wrote the first versions of Netscape Mail and News. Anyway, I digress.

Download and Install

Before you get started, you’ll need to have python installed. I’ve only tested on 2.6.x, it probably will work on 2.5.x and 2.4.x; I’ve no idea if it will work in 3.x. It works on linux, and I’m confident it will work on any *nix or *bsd operating system. To run it on windows, you may need to do some tweaking.

To send your very own HTML email messages from the command line, download version 1.0 of hail-1.0.py and rename it hail. Make sure it’s executable. You might want to put it in your path.

Usage

hail [OPTION]... to-addr

  -h, --help        display this help and exit
  -s, --subject     subject for the email
  -r, --from        the from address
  -q, --plainfile   the file containing the plain email message
  -Q, --htmlfile    the file containing the html email message

to-addr is the email address you want to send the message to

License

As noted in the download, this snip is licensed using the MIT License, which basically means you can do whatever you want with it as long as you keep the copyright notice.

Leave a Reply