The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mail::Message::Head::ResentGroup - a group of header fields about resending

CLASS INHERITANCE

Mail::Message::Head::ResentGroup is a Mail::Reporter

SYNOPSIS

 my $rg = Mail::Message::Head::ResentGroup->new(head => $head,
    From => 'me@home.nl', To => 'You@tux.aq');
 $head->addResentGroup($rg);

 my $rg = $head->addResentGroup(From => 'me');

 my @from = $rg->From;

 my @rgs = $head->resentGroups;
 $rg[2]->delete if @rgs > 2;

DESCRIPTION

A resent group is a set of header lines which describe a intermediate step in the message transport. Resent groups have NOTHING to do with user activety; there is no relation to the user's sense of creating reply, forward or bounce messages at all!

METHODS

Initiation

new [FIELDS], OPTIONS

Create an object which maintains one set of resent headers. The FIELDS are Mail::Message::Field objects from the same header.

OPTIONS which start with capitals will be used to construct additional fields. These option names are prepended with Resent-, keeping the capitization of what is specified.

 OPTION               DEFAULT
 Bcc                  undef
 Cc                   undef
 Date                 <now>
 From                 <required>
 Message-ID           <uniquely created>
 Received             <required>
 Sender               undef
 To                   undef
 head                 <required>
 log                  'WARNINGS'
 trace                'WARNINGS'
Bcc => STRING|OBJECT|OBJECTS
Cc => STRING|OBJECT|OBJECTS
Date => STRING

When this resent-group is dispatched by the resender of the message. Like the Date field, it is not the date and time that the message was actually transported.

From => STRING|OBJECT|OBJECTS
Message-ID => STRING|FIELD

The Resent-Message-ID which identifies this resent group. The FIELD must contain a message id.

Received => STRING

The Received field is the starting line for a resent group of header lines, therefore it is obligatory.

Sender => STRING|OBJECT

Only permitted when more than one from address is specified. In this case, it selects one of these addresses as the main originator of the message.

To => STRING|OBJECT|OBJECTS
head => OBJECT

The header where this resent group belongs to.

log => LEVEL

See Mail::Reporter::new(log)

trace => LEVEL

See Mail::Reporter::new(trace)

The Header

delete

Remove all the header lines which are combined in this resent group from the header.

Access to the Header

bcc

In scalar context, the Resent-Bcc field is returned. In list context, the addresses as specified within the bcc field are returned as Mail::Address objects. Bcc fields are not transmitted (hidden for external parties).

cc

In scalar context, the Resent-Cc field is returned. In list context, the addresses as specified within the cc field are returned as Mail::Address objects.

date

Returns the Resent-Date field, or undef if it was not defined.

dateTimestamp

The timestamp as stored within the Resent-Date field converted to local system time.

destinations

Returns a list of all addresses specified in the Resent-To, -Cc, and -Bcc fields of this resent group.

from

In scalar context, the Resent-From field is returned. In list context, the addresses as specified within the from field are returned as Mail::Address objects.

messageId

Returns the message-ID used for this group of resent lines.

received

The field which describes the Received data of this resent group.

receivedTimestamp

The timestamp as stored within the Received field converted to local system time.

returnPath

The field which describes the Return-Path of this resent group.

sender

In scalar context, the Resent-Sender field is returned. In list context, the addresses as specified within the from field are returned as Mail::Address objects.

set (FIELD => VALUE) | OBJECT

Set a FIELD to a (new) VALUE. The FIELD names which do not start with 'Resent-*' but need it will have that added. It is also an option to specify a fully prepared message field OBJECT. In any case, a field OBJECT is returned. See also Mail::Message::Head::resent() and Mail::Message::Construct::bounce().

Examples:

 my @rgs  = $msg->head->resentGroups;
 my $this = $rgs[0];
 $this->set(To => 'fish@tux.aq');
 $msg->send;

 $msg->head->resent(To => 'fish@tux.aq');   # the same
 $msg->send;

 $msg->bounce(To => 'fish@tux.aq')->send;   # the same
to

In scalar context, the Resent-To field is returned. In list context, the addresses as specified within the to field are returned as Mail::Address objects.

Reading and Writing [internals]

createReceived

Create a recieved field for this resent group. This is automatically called if none was specified during creation of this resent group object.

The content of this field is described in RFC2821 section 4.4. It could use some improvement.

orderedFields

Returns the fields in the order as should appear in header according to rfc2822. For the Resent- fields of the group, the order is not that important, but the Return-Path and Received must come first. Only fields mentioned in the RFC are returned.

Logging and Tracing

defaultTrace [LEVEL, [LEVEL]

See Mail::Reporter::defaultTrace()

errors

See Mail::Reporter::errors()

log [LEVEL [,STRINGS]]

See Mail::Reporter::log()

report [LEVEL]

See Mail::Reporter::report()

reportAll [LEVEL]

See Mail::Reporter::reportAll()

trace [LEVEL]

See Mail::Reporter::trace()

warnings

See Mail::Reporter::warnings()

Other Methods

AUTOLOAD

See Mail::Reporter::AUTOLOAD()

DESTROY

See Mail::Reporter::DESTROY()

inGlobalDestruction

See Mail::Reporter::inGlobalDestruction()

logPriority LEVEL

See Mail::Reporter::logPriority()

logSettings

See Mail::Reporter::logSettings()

notImplemented

See Mail::Reporter::notImplemented()

SEE ALSO

A good start to read is Mail::Box-Overview. More documentation and a mailinglist are available from the project's website at http://perl.overmeer.net/mailbox/.

AUTHOR

Written by Mark Overmeer (mark@overmeer.net) with the help of many. See the ChangeLog for details.

VERSION

This code is beta, version 2.029.

Copyright (c) 2001-2002 by the authors. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.