Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: problem w/ MIME::Lite and multipart/alternative emails

by tirwhan (Abbot)
on Jan 23, 2006 at 18:47 UTC ( [id://525011]=note: print w/replies, xml ) Need Help??


in reply to problem w/ MIME::Lite and multipart/alternative emails

Hmm, works fine for me (what exactly do you mean by "isn't coming through"?):

use MIME::Lite; $email='me@home.com'; $htmlMail = "<html></html>"; $textMail = "texting"; 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, ); print $mailObj->as_string(); __OUTPUT__ Content-Transfer-Encoding: binary Content-Type: multipart/alternative; boundary="_----------=_1138042047 +111520" MIME-Version: 1.0 X-Mailer: MIME::Lite 3.01 (F2.72; T1.15; A1.62; B3.04; Q3.03) Date: Mon, 23 Jan 2006 18:47:27 UT From: admin@domain.com To: me@home.com Subject: subject line here This is a multi-part message in MIME format. --_----------=_1138042047111520 Content-Disposition: inline Content-Length: 13 Content-Transfer-Encoding: binary Content-Type: text/html <html></html> --_----------=_1138042047111520 Content-Disposition: inline Content-Length: 7 Content-Transfer-Encoding: binary Content-Type: text/plain texting --_----------=_1138042047111520--

There are ten types of people: those that understand binary and those that don't.

Replies are listed 'Best First'.
Re^2: problem w/ MIME::Lite and multipart/alternative emails
by geektron (Curate) on Jan 23, 2006 at 18:56 UTC
    Hmm, works fine for me (what exactly do you mean by "isn't coming through"?):

    I'm not getting the rendered display of the message in my mailreader. I've looked at the source, and it is, in fact, there ... but my mailreader (Thunderbird) isn't rendering it).

      So this is actually a Thunderbird question, not a Perl question, right ;-)? With multipart/alternative you'd expect the client to only show one of the alternative contents (that's what that Content-Type is for). Go to your "View"->"Message body" menu in Thunderbird and fiddle with the settings there, it gives you some options on what you want displayed.


      There are ten types of people: those that understand binary and those that don't.
        Actually, it's more of a bug with Thunderbird, apparently. I *do* have my settings so that the original HTML is displayed, but Thunderbird isn't displaying it.

      I had this exact same problem when trying to create a program which would email Lotus Notes users.

      It has been a while, but if I remember correctly the solution was to send the source in the text portion of the message and include the HTML as a multipart attachment. It was something very odd and hacky, but it solved the problem for Notes. If this is something that you truly need to see in Thunderbird, trying doing a combination of attaching one part and putting the other in the base message.

        actually, i found a solution after searching through the mozillazine.org forums.

        the order of the MIME types is important to Thunderbird. irritating at best and causes 'broken' emails at worst. the specific link i found to help solve the problem is here

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://525011]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-23 05:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found