Update:-

I've improved the code snippet below to be more clear of what's happening.

I guess the question really is, should Email::MIME take the single parts headers, when only one part is added to the containing Email::MIME object? Or should the single parts headers be lost, and the containing Email::MIME objects headers be used.


#!/usr/bin/perl

use strict;
use warnings;
use Email::Stuff;
use Data::Dump qw(dump);


### This single part plain text MIME loses it's headers (charset, etc)

my $ea =
Email::Stuff->from('y[...]z.com')->subject('hello')->to('x[...]y.com')
->using( SMTP => '127.0.0.1' )->text_body(
'Hello mum',
'charset' => 'utf-8',
'content_transfer_encoding' => '8bit',
);

#print dump($ea);
print $ea->as_string, "\n\n";


### This single part HTML MIME loses it's headers (charset, etc)

my $ea2 =
Email::Stuff->from('y[...]z.com')->subject('hello')->to('x[...]y.com')
->using( SMTP => '127.0.0.1' )->html_body(
'<b>Hello mum</b>',
'charset' => 'utf-8',
'content_transfer_encoding' => '8bit',
);

#print dump($ea2);
print $ea2->as_string, "\n\n";


### This 2 part plain text and HTML MIME keeps the individual parts headers (charset, etc)

my $ea3 =
Email::Stuff->from('y[...]z.com')->subject('hello')->to('x[...]y.com')
->using( SMTP => '127.0.0.1' )->html_body(
'<b>Hello mum</b>',
'charset' => 'utf-8',
'content_transfer_encoding' => '8bit',
)->text_body(
'Hello mum',
'charset' => 'utf-8',
'content_transfer_encoding' => '8bit',
);

#print dump($ea3);
print $ea3->as_string, "\n\n";


Reply via email to