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

I'm trying to make Mail::Bulkmail (v3.00) handle messages with multipart/alternative content, and I've gotten it to work up to a point (with the help of Email::MIME::CreateHTML). Messages created look fine when viewed in Microsoft Outlook (as an HTML email with all images intact), but on Hotmail and Yahoo mail, not all of the images display (no images show up in Hotmail, and only a few of the images show up in Yahoo).

SIMPLE QUESTION: I'm wondering if anyone else has seen this problem, and has figured out a way to do it so the email shows up correctly when viewed as HTML (the text view of the email is fine, of course)?

SOME BACK STORY: I've previously used Email::MIME::CreateHTML to generate multipart/alternative messages, and after a bit of trial and error, was able to generate messages that display correctly in most common email programs (including internet email). I want to switch to Mail::Bulkmail so I can start adding dynamic content.

THE CODE: here's an abbreviated version of the code I'm currently using. As I said above, this generates email that looks fine in Outlook, but lacks some of the images in other email viewers.

#!/usr/bin/perl use strict; use Fcntl qw( :DEFAULT ); use Email::MIME::CreateHTML; use Mail::Bulkmail 3.00 "/etc/bulkmail/bulkmail.cfg"; my $textfile = "/path/to/textversion.txt"; my $htmlfile = "/path/to/htmlversion.html"; open( TEXT, "$textfile" ) or die; my @textlines = <TEXT>; close( TEXT ); my $plain_text; for( @textlines ) { $plain_text .= $_ } open( HTML, "$htmlfile" ) or die; my @htmllines = <HTML>; close( HTML ); my $html; for( @htmllines ) { $html .= $_ } my $email = Email::MIME->create_html( header => [ From => 'bulk@domain.com', To => 'list@domain.com', Subject => "subject verb object", ], body => $html, text_body => $plain_text, ); my $message = $email->as_string; my $ct_header = $email->content_type; my $bulk = Mail::Bulkmail->new( "LIST" => "./list.txt", "Subject" => "A test message", "Message" => $message, "From" => 'bulk@domain.com', "To" => 'list@domain.com', "Reply-To" => 'listman@domain.com', ) || die Mail::Bulkmail->error(); $bulk->use_envelope(0); $bulk->headers_from_message(1); $bulk->header( "Content-type", $ct_header ); $bulk->bulkmail || die $bulk->error;

Replies are listed 'Best First'.
Re: Help with Mail::Bulkmail and multipart/alternative content
by Anonymous Monk on Aug 31, 2007 at 12:28 UTC
    its a feature of hotmail
      no, I can get full images to display in Hotmail (and others) when I'm just using Email::MIME::CreateHTML, but something about Mail::Bulkmail messes it up (something in the headers?).
        Why not compare