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::Field::Addresses - Fields with e-mail addresses

CLASS INHERITANCE

 Mail::Message::Field::Addresses
   is a Mail::Message::Field::Full
   is a Mail::Message::Field
   is a Mail::Reporter

SYNOPSIS

 my $f = Mail::Message::Field->new(Cc => 'Mail::Box <mailbox@overmeer.net>');

 my $g = Mail::Message::Field->new('Cc');
 $g->addAddress('Mail::Box <mailbox@overmeer.net>');
 $g->addAddress
   ( phrase  => 'Mail::Box'
   , email   => 'mailbox@overmeer.net'
   , comment => 'Our mailing list'     # deprecated, use phrase
   );

DESCRIPTION

All header fields which contain e-mail addresses only. Not all address fields have the same possibilities, but they are all parsed the same: you never know how broken the applications are which produce those messages.

When you try to create constructs which are not allowed for a certain kind of field, you will be warned.

METHODS

Initiation

from FIELD, OPTIONS

See Mail::Message::Field::Full::from()

new DATA

(Class method)

 OPTION               DEFAULT
 attributes           C<not accepted>
 charset              C<undef>
 encoding             'q'
 extra                C<not accepted>
 force                false
 is_structured        1
 language             C<undef>
 log                  'WARNINGS'
 trace                'WARNINGS'
attributes => ATTRS

See Mail::Message::Field::Full::new(attributes)

charset => STRING

See Mail::Message::Field::Full::new(charset)

encoding => 'q'|'Q'|'b'|'B'

See Mail::Message::Field::Full::new(encoding)

extra => STRING

See Mail::Message::Field::Full::new(extra)

force => BOOLEAN

See Mail::Message::Field::Full::new(force)

is_structured => BOOLEAN

See Mail::Message::Field::Full::new(is_structured)

language => STRING

See Mail::Message::Field::Full::new(language)

log => LEVEL

See Mail::Reporter::new(log)

trace => LEVEL

See Mail::Reporter::new(trace)

Examples:

parse STRING

Parse the supplied address string, and store the found data in this object.

The Field

addAddress [ADDRESS], OPTIONS

Add an ADDRESS to the field. The addresses are organized in groups. If no group is specified, the default group is taken to store the address in. If no ADDRESS is specified, the option must be sufficient to create a Mail::Message::Field::Address from. See the OPTIONS of Mail::Message::Field::Address::new().

 OPTION               DEFAULT
 group                ''
group => STRING
addAttribute ...

Attributes are not supported for address fields.

addComment COMMENT, OPTIONS

See Mail::Message::Field::Full::addComment()

addExtra ...

Extras are not permitted in address fields.

addGroup GROUP|OPTIONS

Add a group of addresses to this field. A GROUP can be specified, which is a Mail::Message::Field::AddrGroup object, or one is created for you using the OPTIONS. The group is returned.

 OPTION               DEFAULT
 name                 ''
name => STRING
addPhrase STRING, OPTIONS

See Mail::Message::Field::Full::addPhrase()

addresses

Returns a list with all addresses defined in any group of addresses: all addresses which are specified on the line. The addresses are Mail::Message::Field::Address objects.

Examples:

 my @addr = $field->addresses;
attributes

See Mail::Message::Field::Full::attributes()

clone

See Mail::Message::Field::clone()

consumeAddress STRING

Try to destilate address information from the STRING. Returned are an address object and the left-over string. If no address was found, the first returned value is undef.

consumeDomain STRING

Try to get a valid domain representation from STRING. Returned are the domain string as found (or undef) and the rest of the string.

createComment STRING, OPTIONS

See Mail::Message::Field::Full::createComment()

createPhrase STRING, OPTIONS

See Mail::Message::Field::Full::createPhrase()

group NAME

Returns the group of addresses with the specified NAME, or undef if it does not exist. If NAME is undef, then the default groep is returned.

groupNames

Returns a list with all group names which are defined.

groups

Returns all address groups which are defined in this field. Each element is a Mail::Message::Field::AddrGroup object.

isStructured

See Mail::Message::Field::isStructured()

length

See Mail::Message::Field::length()

Access to the Field

Name

See Mail::Message::Field::Name()

attribute NAME [, VALUE]

See Mail::Message::Field::attribute()

body

See Mail::Message::Field::body()

comment [STRING]

See Mail::Message::Field::comment()

dateToTimestamp STRING

See Mail::Message::Field::dateToTimestamp()

decodedBody OPTIONS

See Mail::Message::Field::Full::decodedBody()

folded

See Mail::Message::Field::folded()

foldedBody [BODY]

See Mail::Message::Field::foldedBody()

name

See Mail::Message::Field::name()

nrLines

See Mail::Message::Field::nrLines()

See Mail::Message::Field::print()

size

See Mail::Message::Field::size()

string [WRAP]

See Mail::Message::Field::string()

stripCFWS [STRING]

See Mail::Message::Field::stripCFWS()

toDate [TIME]

See Mail::Message::Field::toDate()

toDisclose

See Mail::Message::Field::toDisclose()

toInt

See Mail::Message::Field::toInt()

unfoldedBody [BODY, [WRAP]]

See Mail::Message::Field::unfoldedBody()

wellformedName [STRING]

See Mail::Message::Field::wellformedName()

Reading and Writing [internals]

consume LINE | (NAME,BODY|OBJECTS)

See Mail::Message::Field::consume()

consumeComment STRING

See Mail::Message::Field::Full::consumeComment()

consumeDotAtom STRING

See Mail::Message::Field::Full::consumeDotAtom()

consumePhrase STRING

See Mail::Message::Field::Full::consumePhrase()

decode STRING, OPTIONS

See Mail::Message::Field::Full::decode()

defaultWrapLength [LENGTH]

See Mail::Message::Field::defaultWrapLength()

encode STRING, OPTIONS

See Mail::Message::Field::Full::encode()

fold NAME, BODY, [MAXCHARS]

See Mail::Message::Field::fold()

setWrapLength [LENGTH]

See Mail::Message::Field::setWrapLength()

unfold STRING

See Mail::Message::Field::unfold()

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.038.

Copyright (c) 2001-2003 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.