#!/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 = ; close( TEXT ); my $plain_text; for( @textlines ) { $plain_text .= $_ } open( HTML, "$htmlfile" ) or die; my @htmllines = ; 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;