http://www.perlmonks.org?node_id=525001

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

i'm trying to send 'mixed' email: a message where the MUA decides which type to display (HTML or plaintext)

I've read through the perldoc for MIME::Lite and used the following to contruct the email:

my $mailObj = MIME::Lite->new( From => 'admin@domain.com', To => $email, Subject => "subject line here", Type => 'multipart/alternative' ); $mailObj->attach( Type => 'text/html', Data => $htmlMail, ); $mailObj->attach( Type => 'text/plain', Data => $textMail, ); $mailObj->send();
the problem with the code: the HTML portion isn't coming through. using 'multipart/mixed' does send both portions, renders the HTML mail, but (as expected) attaches the text portion of the email -- which isn't the behavior i want.

i'm sure i'm missing something, but i'm not sure which direction i need to go.

EDIT: the problem is isolated to Thunderbird. Outlook handles the message appropriately, but Thunderbird ignores the HTML content.

EDIT 2: the problem is Thunderbird. it displays the last recognized MIME type, so if the message is built as above, the text-only portion is displayed. reversing the order builds a message so that Thunderbird does, in fact, display the HTML when 'Show Original HTML' is selected as the preference. (per this mozillazine.org forum post)