First of all, I have to warn you that using HTML in emails is almost always inappropriate. Use plain text. If you have to send HTML, than send it as an attachment.
For those cases, where HTML message has to be sent and there is no choice in the matter, here is a small perl script – send_html_mail.pl
Edit a few lines at the beginning of the file to suit your needs. From address and Subject line must be changed. Locactions of two files – list of recepients and the body of the message – can be either specified on the command line or will be taken from default values hardcoded in the script.
Run the script as:
send_html_mail.pl message.html recepients.txt
If you changed the location of data files or if you are using defaults, than you don’t have to pass any arguments to the script.
List of recepients is expected to be a comma separated list of names and emails. An example file could look like this:
You There,firstname.lastname@example.org Him Somewhere,email@example.com
<HTML> <BODY> <H1>Hi there!</H1> <DIV>This is an HTML message.</DIV> </BODY> </HTML>
It is easy to change the script to send plain text messages instead of HTML. Just change the line that specifies Content-Type as “text/html” to “text/plain”.