Re: Directly changing To & From field in the header
Mark Overmeer <[email protected]> Tue, 8 Feb 2005 08:34:44 +0100
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Organization | MARKOV Solutions |
| Message-ID | <[email protected]> |
* Zaphod ([email protected]) [050207 23:39]: > Where is my body going, or where is it NOT coming from? I suspect something is incorrect in add_notice(). $Message->decoded returns a body object (is abbrev of $Message->body->decoded). So when you process it, you need to use the $dec->lines or $dec->string. > <snip> > $Counter=0; > foreach $Message ($Folder->messages){ > my $MsgId = $Message->head->get('message-id'); > $MsgId =~ s/</<vm/; You don't use/need this. > my $Body = $Message->decoded; > $Body=add_notice($Body); #regex removes any email address'es from body my $text = $Message->decoded->string; $text =~ s/....//; > my $ForwardBody=Mail::Message::Body->new($Body); > my @ToAddress=Mail::Address->new('[email protected]'); my $ToAddress = Mail::Address->new('[email protected]'); ^^ alternative my $ToAddress = '[email protected]'; > my @FromAddress=Mail::Address->new('[email protected]'); > my > $ForwardMessage=Mail::Message->buildFromBody($ForwardBody,From=>\@FromAddress > ,To=>\@ToAddress); my $fm = Mail::Message->build(From => $from, To => $to, data => $text); > $ForwardMessage->head->print; produces; > > Can't locate object method "print" via package "This is a multi-part message > in MIME format. > ------=_NextPart_000_0143_01C50D07.1516E000 > > [.... the entire body of the message ....] > > "?) at test2.cgi line 41. But probably you need: (it takes care of the Refences field, and the like) $oldmsg->forward(body => $newbody, From => ..., To => ...); Are you using the HTML version of the docs? That will improve your access to this huge library. -- MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions [email protected] [email protected] http://Mark.Overmeer.net http://solutions.overmeer.net