OVERLOADED

METHODS

See METHODS in Mail::Reporter

Constructors

$obj->clone( %options )
See clone in Mail::Message.
$obj->dup

Duplicate the message. The result will again be a Mail::Internet compatible object.

$obj->empty

Remove all data from this object. Very dangerous!

$class->new( [$arg], [%options] )
Option Defined in Default

Body

undef

FoldLength

79

Header

undef

MailFrom

'KEEP'

Modify

0

body

Mail::Message

undef

body_type

Mail::Message

Mail::Message::Body::Lines

deleted

Mail::Message

<false>

field_type

Mail::Message

undef

head

Mail::Message

undef

head_type

Mail::Message

Mail::Message::Replace::MailHeader

labels

Mail::Message

{}

log

Mail::Reporter

'WARNINGS'

messageId

Mail::Message

undef

modified

Mail::Message

<false>

trace

Mail::Reporter

'WARNINGS'

trusted

Mail::Message

<false>

Body => ARRAY-OF-LINES
Array of "\n" terminated lines. If not specified, the lines will be read from $arg.
FoldLength => INTEGER
Number of characters permitted on any refolded header line. Passed to Mail::Message::Replace::MailHeader::new(FoldLength).
Header => OBJECT
The Mail::Header object, which is passed here, is a fake one as well... It is translated into a new(head). If not given, the header will be parsed from the $arg.
MailFrom => 'IGNORE'|'ERROR'|'COERCE'|'KEEP'
What to do with leading "From " lines in e-mail data. Passed to Mail::Message::Replace::MailHeader::new(MailFrom).
Modify => BOOLEAN
Whether to re-fold all the incoming fields. Passed to Mail::Message::Replace::MailHeader::new(Modify).
body => OBJECT
body_type => CLASS
deleted => BOOLEAN
field_type => CLASS
head => OBJECT
head_type => CLASS
labels => ARRAY|HASH
log => LEVEL
messageId => STRING
modified => BOOLEAN
trace => LEVEL
trusted => BOOLEAN
» Example: replace traditional Mail::Internet by this wrapper
  # was
  use Mail::Internet;
  my $mi = Mail::Internet->new(@options);

  # becomes
  use Mail::Message::Replace::MailInternet;
  my $mi = Mail::Internet->new(@options);
» Error: Mail::Internet does not support this kind of data

The ARGS data can only be a file handle or an ARRAY. Other data types are not supported (see read() if you want to have more).

Attributes

$obj->MailFrom( [STRING] )

Your email address.

Constructing a message

$obj->add_signature( [$filename] )

Replaced by sign(), but still usable. $filename is the file which contains the signature, which defaults to $ENV{HOME}/.signature.

$obj->bounce( [<$rg_object|%options>] )
See bounce in Mail::Message::Construct::Bounce.
$class->build( [$message|$part|$body], $content )
See build in Mail::Message::Construct::Build.
$class->buildFromBody( $body, [$head], $headers )
See buildFromBody in Mail::Message::Construct::Build.
$obj->extract( ARRAY|$fh )

Read header and body from an ARRAY or $fh

$obj->forward( %options )
See forward in Mail::Message::Construct::Forward.
$obj->forwardAttach( %options )
See forwardAttach in Mail::Message::Construct::Forward.
$obj->forwardEncapsulate( %options )
See forwardEncapsulate in Mail::Message::Construct::Forward.
$obj->forwardInline( %options )
See forwardInline in Mail::Message::Construct::Forward.
$obj->forwardNo( %options )
See forwardNo in Mail::Message::Construct::Forward.
$obj->forwardPostlude
See forwardPostlude in Mail::Message::Construct::Forward.
$obj->forwardPrelude
See forwardPrelude in Mail::Message::Construct::Forward.
$obj->forwardSubject( STRING )
See forwardSubject in Mail::Message::Construct::Forward.
$obj->read( ARRAY|$fh, %options )
$class->read( ARRAY|$fh, %options )

Read header and body from the specified ARRAY or $fh. When used as object method, Mail::Message::read() is called, to be MailBox compliant. As class method, the Mail::Internet compatible read is called. %options are only available in the first case.

Option Defined in Default

body_type

Mail::Message::Construct::Read

undef

strip_status_fields

Mail::Message::Construct::Read

<true>

body_type => CLASS
strip_status_fields => BOOLEAN
$obj->read_body( ARRAY|$fh )

Read only the message's body from the ARRAY or $fh.

$obj->read_header( ARRAY|$fh )

Read only the message's header from the ARRAY or $fh

$obj->rebuild( %options )
See rebuild in Mail::Message::Construct::Rebuild.
$obj->reply( %options )

BE WARNED: the main job for creating a reply is done by Mail::Message::reply(), which may produce a result which is compatible, but may be different from Mail::Internet's version.

Option Defined in Default

Bcc

Mail::Message::Construct::Reply

undef

Cc

Mail::Message::Construct::Reply

<'cc' in current>

Exclude

[]

From

Mail::Message::Construct::Reply

<'to' in current>

Inline

>

Keep

[]

Message-ID

Mail::Message::Construct::Reply

<uniquely generated>

ReplyAll

<false>

Subject

Mail::Message::Construct::Reply

replySubject()

To

Mail::Message::Construct::Reply

<sender in current>

body

Mail::Message::Construct::Reply

undef

group_reply

Mail::Message::Construct::Reply

<true>

header_template

$ENV{HOME}/.mailhdr

include

Mail::Message::Construct::Reply

'INLINE'

max_signature

Mail::Message::Construct::Reply

10

message_type

Mail::Message::Construct::Reply

Mail::Message

postlude

Mail::Message::Construct::Reply

undef

prelude

Mail::Message::Construct::Reply

undef

quote

Mail::Message::Construct::Reply

'> '

signature

Mail::Message::Construct::Reply

undef

strip_signature

Mail::Message::Construct::Reply

qr/^--\s/

Bcc => ADDRESSES
Cc => ADDRESSES
Exclude => ARRAY-OF-NAMES
Remove the fields witht the specified names from the produced reply message.
From => ADDRESSES
Inline => STRING
Quotation STRING, which is translated into reply(quote). The normal default of quote is "> ", in stead of ">".
Keep => ARRAY-OF-NAMES
Copy all header fields with the specified NAMES from the source to the reply message.
Message-ID => STRING
ReplyAll => BOOLEAN
Reply to the group? Translated into reply(group_reply), which has as default the exact oposite of this option, being true.
Subject => STRING|CODE
To => ADDRESSES
body => BODY
group_reply => BOOLEAN
header_template => FILENAME|undef
Read the return header from the template file. When this is explicitly set to undef, or the file does not exist, then a header will be created.
include => 'NO'|'INLINE'|'ATTACH'
max_signature => INTEGER
message_type => CLASS
postlude => BODY|LINES
prelude => BODY|LINES
quote => CODE|STRING
signature => BODY|MESSAGE
strip_signature => REGEXP|STRING|CODE
$obj->replyPrelude( [STRING|$field|$address|ARRAY-$of-$things] )
See replyPrelude in Mail::Message::Construct::Reply.
$obj->replySubject( STRING )
$class->replySubject( STRING )
See replySubject in Mail::Message::Construct::Reply.
$obj->sign( %options )

Add a signature (a few extra lines) to the message.

Option Default

File

undef

Signature

''

File => FILENAME
Specifies a filename where the signature is in.
Signature => STRING|ARRAY-OF-LINES
The signature in memory.

The message

$obj->container
See container in Mail::Message.
$obj->isDummy
See isDummy in Mail::Message.
$obj->isPart
See isPart in Mail::Message.
$obj->messageId
See messageId in Mail::Message.
$obj->nntppost( %options )

Send an NNTP message (newsgroup message), which is equivalent to Mail::Transport::NNTP or Mail::Message::send() with via 'nntp'.

Option Default

Debug

<false>

Host

<from Net::Config>

Port

119

Debug => BOOLEAN
Host => HOSTNAME
Port => INTEGER
$obj->partNumber
See partNumber in Mail::Message.
$obj->print( [$fh] )

Prints the whole message to the specified $fh, which default to STDOUT. This calls Mail::Message::print().

$obj->send( $type, %options )

Send via Mail Transfer Agents (MUA). These will be handled by various Mail::Transport::Send extensions. The test $type is not supported.

$obj->size
See size in Mail::Message.
$obj->toplevel
See toplevel in Mail::Message.
$obj->write( [$fh] )
See write in Mail::Message.

The header

$obj->add( $lines )

Add header lines, which simply calls Mail::Message::Head::add() on the header for each specified LINE. The last added LINE is returned.

$obj->bcc
See bcc in Mail::Message.
$obj->cc
See cc in Mail::Message.
$obj->clean_header

Not to be used, replaced by header().

$obj->combine( $tag, [$with] )

Not implemented, because I see no use for it.

$obj->date
See date in Mail::Message.
$obj->delete( $name, [$index]] )

Delete the fields with the specified $name. The deleted fields are returned.

BE WARNED: if no $name is specified, the delete is interpreted as the deletion of the message in a folder, so Mail::Box::Message::delete() will be called. This may have no negative effect at all...

Calls Mail::Message::Replace::MailHeader::delete()

$obj->destinations
See destinations in Mail::Message.
$obj->fold( [$length] )

Fold all the fields to a certain maximum $length. Implemented by Mail::Message::Replace::MailHeader::fold()

$obj->fold_length( [[$tag], $length] )

Set the maximum line $length. $tag is ignored. Implemented by Mail::Message::Replace::MailHeader::fold_length()

$obj->from
See from in Mail::Message.
$obj->get( $name, [$index] )

Get all the header fields with the specified $name. In scalar context, only the first fitting $name is returned. Even when only one $name is specified, multiple lines may be returned: some fields appear more than once in a header. Calls Mail::Message::Replace::MailHeader::get()

$obj->guessTimestamp
See guessTimestamp in Mail::Message.
$obj->nrLines
See nrLines in Mail::Message.
$obj->replace( $tag, $line, [$index] )

Adds LINES to the header, but removes fields with the same name if they already exist. Calls Mail::Message::Replace::MailHeader::replace()

$obj->sender
See sender in Mail::Message.
$obj->study( $fieldname )
See study in Mail::Message.
$obj->subject
See subject in Mail::Message.
$obj->tidy_headers

No effect anymore (always performed).

$obj->timestamp
See timestamp in Mail::Message.
$obj->to
See to in Mail::Message.

The body

$obj->body( $lines|@lines )

Returns an ARRAY of lines, representing the body. With arguments, a new body will be created. In Mail::Internet, the body is not an object but a simple array.

BE WARNED: this overrules the Mail::Message::body() method, which may cause some confusion. Use bodyObject() to get access to that body's data.

$obj->bodyObject( [$body] )

Calls Mail::Message::body(), because that body method is overruled by the one which has a Mail::Internet compatible interface.

$obj->contentType
See contentType in Mail::Message.
$obj->decoded( %options )
See decoded in Mail::Message.
$obj->encode( %options )
See encode in Mail::Message.
$obj->isMultipart
See isMultipart in Mail::Message.
$obj->isNested
See isNested in Mail::Message.
$obj->parts( [<'ALL'|'ACTIVE'|'DELETED'|'RECURSE'|$filter>] )
See parts in Mail::Message.
$obj->remove_sig( [$nrlines] )

Remove the signature of a message with a maximum of $nrlines lines, which defaults to 10. The work is done on the decoded body content, by Mail::Message::Body::stripSignature().

$obj->smtpsend( %options )

This method is calling Mail::Message::send() via smtp, which is implemented in Mail::Transport::SMTP. The implementation is slightly different, so this method is not 100% compliant.

Option Default

Debug

<false>

Hello

<helo_domain from Net::Config>

Host

$ENV{SMTPHOSTS} or from Net::Config

MailFrom

$ENV{MAILADDRESS} or $ENV{USER}

Port

25

Debug => BOOLEAN
Hello => STRING
Host => HOSTNAME
Only the first detected HOSTNAME is taken, so differs from the original implementation.
MailFrom => STRING
Your e-mail address. This simulated Mail::Internet object does not try to create an e-mail address from the sendmail configuration file, because that is generally a bad idea in environments with virtual hosts, as we have now-adays.
Port => INTEGER
$obj->tidy_body

Removes blank lines from begin and end of the body.

Flags

$obj->deleted( [BOOLEAN] )
See deleted in Mail::Message.
$obj->isDeleted
See isDeleted in Mail::Message.
$obj->isModified
See isModified in Mail::Message.
$obj->label( $label|PAIRS )
See label in Mail::Message.
$obj->labels
See labels in Mail::Message.
$obj->labelsToStatus
See labelsToStatus in Mail::Message.
$obj->modified( [BOOLEAN] )
See modified in Mail::Message.
$obj->statusToLabels
See statusToLabels in Mail::Message.

The whole message as text

$obj->as_mbox_string

Returns the whole message as one string, which can be included in an MBOX folder (while not using Mail::Box::Mbox). Lines in the body which start with From are escaped with an >.

$obj->file
See file in Mail::Message::Construct::Text.
$obj->lines
See lines in Mail::Message::Construct::Text.
$obj->printStructure( [$fh|undef],[$indent] )
See printStructure in Mail::Message::Construct::Text.
$obj->string
See string in Mail::Message::Construct::Text.

The nasty bits

$obj->isa( $class )
$class->isa( $class )

Of course, the isa() class inheritance check should not see our nasty trick.

Internals

$obj->clonedFrom
See clonedFrom in Mail::Message.
$class->coerce( $message )

Coerce (adapt type) of the specified $message (anything Mail::Message::coerce() accepts) into an Mail::Internet simulating object.

$obj->isDelayed
See isDelayed in Mail::Message.
$obj->readBody( $parser, $head, [$bodytype] )
See readBody in Mail::Message.
$obj->readFromParser( $parser, [$bodytype] )
See readFromParser in Mail::Message.
$obj->readHead( $parser, [$class] )
See readHead in Mail::Message.
$obj->recursiveRebuildPart( $part, %options )
See recursiveRebuildPart in Mail::Message::Construct::Rebuild.
$obj->storeBody( $body )
See storeBody in Mail::Message.
$obj->takeMessageId( [STRING] )
See takeMessageId in Mail::Message.

Error handling

$obj->AUTOLOAD
See AUTOLOAD in Mail::Message::Construct.
$obj->addReport( $object )
See addReport in Mail::Reporter.
$obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )
$class->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )
See defaultTrace in Mail::Reporter.
$obj->errors
See errors in Mail::Reporter.
$obj->log( [$level, [$strings]] )
$class->log( [$level, [$strings]] )
See log in Mail::Reporter.
$obj->logPriority( $level )
$class->logPriority( $level )
See logPriority in Mail::Reporter.
$obj->logSettings
See logSettings in Mail::Reporter.
$obj->notImplemented
See notImplemented in Mail::Reporter.
$obj->report( [$level] )
See report in Mail::Reporter.
$obj->reportAll( [$level] )
See reportAll in Mail::Reporter.
$obj->shortSize( [$value] )
$class->shortSize( [$value] )
See shortSize in Mail::Message.
$obj->shortString
See shortString in Mail::Message.
$obj->trace( [$level] )
See trace in Mail::Reporter.
$obj->warnings
See warnings in Mail::Reporter.

Cleanup

$obj->DESTROY
See DESTROY in Mail::Reporter.
$obj->destruct
See destruct in Mail::Message.