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

I am writing a perl script that attachs html document. I am using MIME::Lite to send the message out. However, I am not able to attach it. Here is the sniplet of the code
use MIME::Lite; my $msg = MIME::Lite->new ( From => "from@example.org", To => "to@example.org", Subject => "My subject", Type => 'text/html' ); $msg -> attach ( Type => 'text/html', Data => "<html><body>hi</body></html>" );
Am I missing anything? Thanks

Replies are listed 'Best First'.
Re: attach html doc
by borisz (Canon) on Jul 15, 2004 at 23:12 UTC
    The Type of your mail is wrong. Your first Type must be Type => 'multipart/mixed'.
    my $msg = MIME::Lite->new ( From => "from@example.org", To => "to@example.org", Subject => "My subject", Type => 'multipart/mixed' ); $msg -> attach ( Type => 'text/html', Data => "<html><body>hi</body></html>" );
    Boris