Sending HTML mail

Björn Lindberg d95-bli at
Tue Nov 9 07:25:01 PST 2004

Jason Gurtz <jason at> writes:

> On 11/9/2004 07:02, Björn Lindberg wrote:
> > I have a bit of an embarassing question, actually. I need to send HTML
> > email.
> It's not so bad, I've had to do worse to please the PHB's around here  :/
> > Right now I am sending email programmatically invoking sendmail
> > directly. The emails I need to send are inline HTML emails. Just
> > sending the HTML as message body doesn't work right (as
> > expected).
> In short, you probably need to change the mime type of the message to
> something like multipart/mixed or multipart/alternative.  Typically,
> that's done with the Content-type: header.

I managed to get it working by putting in the following headers:

  Mime-Version: 1.0;
  Content-Type: text/html; charset="ISO-8859-1";
  Content-Transfer-Encoding: 8bit;

I don't know how robust it is though.

> If nail can compose that type of message that would be close to an ideal
> solution.  My hunch though is that you'll have to come up with a perl
> script, perhaps using the MIME::Lite module.  You can even get rid of the
> sendmail dependency by using the Net::SMTP module.
> <!>

Thanks for the ideas. Currently the mail sent is just an HTML document
with external links for images. I am going to investigate including
the images, although I'd prefer using Python since that is what I'm
using for the rest of this system.


More information about the lfs-chat mailing list