mellin has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to come up with a script that periodically sends mailbox sizes to our users in graphical form (e.g. chart). Now that the actual code behind the chart creation is done I should find a way to send that chart as an image part of the E-mail message to each mailbox owner.

What I realized is that this is about message headers since client side software (MS Office Outlook etc.) has to know someway that this message should be interpreted as HTML instead of plain text. But what I don't really know is that what Perl module I should pick among all those available from CPAN.

Currently I'm using Net::SMTP but it does not have HTML capabilities. Any ideas, anyone?

Replies are listed 'Best First'.
Re: Perl and HTML E-mail
by Corion (Patriarch) on Feb 11, 2009 at 08:09 UTC

    MIME::Lite is a convenient way to attach or inline elements to mails.

Re: Perl and HTML E-mail
by uwevoelker (Pilgrim) on Feb 11, 2009 at 09:51 UTC
Re: Perl and HTML E-mail
by stonecolddevin (Parson) on Feb 11, 2009 at 14:49 UTC
Re: Perl and HTML E-mail
by dxxd116 (Beadle) on Feb 11, 2009 at 15:07 UTC
    Just setting the header: "Content-type: text/html, charset=utf-8" before the email message body will inform your email client that your email is a HTML. No need to use any extra modules.

      Yeah, that was what I figured out myself as well, but I don't know how would I do change the content type header with Net::SMTP module?

      I found MIME::Lite::TT::HTML and even though I find the template solution to be a bit too much, it is really simple to use.

        $smtp=Net::SMTP->new('your smtp server'); $smtp->mail('your email address'); $smtp->to('Your reciepient'); $smtp->data(); $smtp->datasend("Content-type:TEXT/html,charset=utf-8\n"); $smtp->datasend("To: someone\@somedomain.com\n"); $smtp->datasend("\n"); $smtp->datasend("<html>Your html here!</html>"); $smtp->dataend(); $smtp->quit();