Hi All,
I've release a new email plugin for cgi-app based around Email::Stuff,
CGI::Application::Plugin::Email.
I've been going through Email::Stuff to try and understand it better.
Looking at the RT there is a bug that's been sitting there for a year or so.
http://rt.cpan.org/Public/Bug/Display.html?id=27320
I've gone through the code and started to write a patch... But it really
does look like this could be an issue with Email::MIME rather than
Email::Stuff.
The problem is that if you create a new Email::MIME object without
setting headers (it'll default to us-ascii), then add to it only one
part with headers set (such as utf-8) the result is a single part
message, but the headers defined by the part are lost.
This isn't an issue if two parts are added (such as one text/plain,
another html/text), as the headers for the individual parts are then
maintained.
The question is should I continue to patch Email::Stuff to replace the
main Email::MIME objects headers with that of the parts if it is only
and single part message.
Or should the patch be for Email::MIME to do this?
A code sample based on Email::Stuff to show this issue has been included
below:-
Lyle
#!/usr/bin/perl
use strict;
use warnings;
use Email::Stuff;
use Data::Dump qw(dump);
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";
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";
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";