How to send HTML Mail to a Mailing List

Many stores use GNU Mailman to maintain a mailing list for store sales and newsletters. Satchmo has this as a built-in option, for example. It isn’t too bad an option, after all. You can easily set options so that it is “push only” and therefore only the mailing list owner can send mail.

(Yes, it really isn’t a great idea. I heartily recommend a service such as Aweber to manage your list, which will lead to much better legal compliance and more professional results. But bear with me, not all store owners want to pay for additional services.)

However, what if you want to send nicely formatted HMTL newsletters? How do you get your mail client to send those so that they’ll look nice for your customers? Answer, you don’t. You send it manually from the commandline.

Here’s how…

Go to the server where you’ve got your store. Hopefully it is linux or similar. I couldn’t care less about how to do this from Windows. Not my bag.

Make a well-formatted email and put it on the server somewhere. In this example, we’ll call it “newsletter.html”

Now copy and modify this for your own needs.

echo "From:"
echo "To:"
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/mixed;"
echo ' boundary="PAA08673.1018277622/"'
echo "Subject: My Newsletter"
echo ""
echo "This is a MIME-encapsulated message"
echo ""
echo "--PAA08673.1018277622/"
echo "Content-Type: text/html"
echo ""
cat newsletter.html
echo ""
echo "--PAA08673.1018277622/"
) | /usr/sbin/sendmail -t


Paste that into your commandline, and you’ll send that HMTL email, formatted “raw”, just the way you want it.

Coders Eye - Web Dev Tutorials and How-To Guides for Beginners
Enable registration in settings - general