Re: Directly changing To & From field in the header
Vic Norton <[email protected]> Mon, 7 Feb 2005 15:09:49 -0500
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <p06210204be2d783c27c2@[192.168.1.100]> |
I copied your suggestion directly into the script I presented,
Gilles. I get exactly the same error message.
/Library/Perl/5.8.1/Mail/Message/Head/Complete.pm: Line 172:
Can't call method "clone" without a package or object reference
The problem came up when I was tried to create a plain text mail
message and then, in a loop, change the to-field and body before
sending it out. So far I've been totally unsuccessful in doing this.
Perhaps the way I had been doing it before was better anyway. Then I
would just create a new head, new body, and new message on each
iteration of the loop.
Thanks for your advice. I wish it had worked.
Regards,
Vic
At 7:48 PM +0100 2/6/05, Gilles wrote:
>
>> $msg->head->reset('To', "\"Vic\" <norton\@dacor.net>"); # problem here
>>
>> What is wrong with this example. Why can't I
>> reset the 'To' field. I get the error message
>>
>> Error: File Complete.pm; Line 172:
>> Can't call method "clone" without a package or object reference
>
>The arguments to "reset" are
> 1. the name of the field (a string)
> 2. a list of "Mail::Message::Field" objects (*not* a string)
>
>So, the following works:
>
>$msg->head->reset( 'To', Mail::Message::Field->new( 'To', "\"Vic\"
><norton\@dacor.net>") ) ;
>
>
>Best regards,
>Gilles