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;
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |