rebuilding a message from a $Message->decoded
"Zaphod" <[email protected]> Mon, 7 Feb 2005 15:44:18 -0800
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <01de01c50d6e$f14260b0$b0f07c44@mainrkclov3cts> |
If I pull off a
$Body=$Message->decoded;
and
my $From = ($Message->from)[0];
make some regex changes to the $Body, for instance;
my $text = qr(Content-Type:\s*text/plain.+?\n\n)is;
my $html = qr(Content-Type:\s*text/html.+?\n\n)is;
my $addr = "Original address as received:$From";
$Body =~ s/($html)/$1\n<p>$addr<br>\n\n/;
$Body =~ s/($text)/$1\n$addr\n\n/;
How do I go about making a Sendable message out of them again?
I thought
my @ToAddress=Mail::Address->new('Mr Foo Bar','[email protected]');
my @FromAddress=Mail::Address->new('Mr Foobar too','[email protected]');
my $SendableMessage=Mail::Message->buildFromBody($Body,From=>@FromAddress
,@ToAddress);
$SendableMessage->send(via=>'sendmail');
but nope.
What do I need to do?
Zaphod