date header gets clobbered by Email::Simple's goofy behavior
Opened this issue · 1 comments
rjbs commented
reported by Eric Brine:
use Email::Stuffer;
for my $hack (0,1) {
my $msg = Email::Stuffer
->from('x@x.com')
->to('y@y.com')
->subject("Subject")
->text_body("Body\n");
$msg->as_string() if $hack;
$msg->header(Date => 'Thu, 20 Feb 2014 20:13:54 -0500');
print "$hack: $_\n" for $msg->as_string() =~ /^Date: .*/mg;
}
__END__
0: Date: Sat, 22 Feb 2014 07:31:00 -0800
1: Date: Thu, 20 Feb 2014 20:13:54 -0500
rjbs commented
Bleh. We could always do this:
- my @headers_skip = $_[1]->header_names;
+ my @headers_skip = grep { $_ ne 'Date' } $_[1]->header_names;
...but then we have an alternate problem, where if we try to set the parts of the message, we could lose the date on the part we're trying to use.
There is not enough abstraction here.