MIME-Lite-HTML
view release on metacpan or search on metacpan
sub build_mime_object {
my ($self,$html,$txt,$ref_mail)=@_;
my ($txt_part, $part,$mail);
# Create part for HTML if needed
if ($html) {
my $ref = ($txt || @$ref_mail) ? {} : $self->{_param};
$part = new MIME::Lite(%$ref,
'Type' => 'TEXT',
'Encoding' => $self->{_htmlencoding},
'Data' => $html);
$part->attr("content-type"=> "text/html; charset=".$self->{_htmlcharset});
# Remove some header for Eudora client in HTML and related part
$part->replace("MIME-Version" => "");
$part->replace('X-Mailer' =>"");
$part->replace('Content-Disposition' =>"");
# only html, no images & no txt
$mail = $part unless ($txt || @$ref_mail);
}
# Create part for text if needed
if ($txt) {
my $ref = ($html ? {} : $self->{_param} );
$txt_part = new MIME::Lite (%$ref,
'Type' => 'TEXT',
'Data' => $txt,
'Encoding' => $self->{_textencoding});
$txt_part->attr("content-type" =>
"text/plain; charset=".$self->{_textcharset});
# Remove some header for Eudora client
$txt_part->replace("MIME-Version" => "");
$txt_part->replace("X-Mailer" => "");
$txt_part->replace("Content-Disposition" => "");
# only text, no html
$mail = $txt_part unless $html;
}
# If images and html and no text, multipart/related
( run in 1.430 second using v1.01-cache-2.11-cpan-524268b4103 )