Mail::Message::Replace::MailInternet - fake Mail::Internet
Mail::Message::Replace::MailInternet is a Mail::Message is a Mail::Reporter
!!! BETA !!! # change use Mail::Internet; # into use Mail::Message::Replace::MailInternet; # in existing code, and the code should still work, but # with the Mail::Message features.
This module is a wrapper around a Mail::Message, which simulates a Mail::Internet object. The name-space of that module is hijacked and many methods are added.
Most methods will work without any change, but you may need to have a look at your smtpsend() and send() calls.
Extends "DESCRIPTION" in Mail::Message.
Extends "METHODS" in Mail::Message.
Extends "Constructors" in Mail::Message.
Inherited, see "Constructors" in Mail::Message
Duplicate the message. The result will again be a Mail::Internet compatible object.
Remove all data from this object. Very dangerous!
-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>
Array of "\n" terminated lines. If not specified, the lines will be read from $arg.
"\n"
Number of characters permitted on any refolded header line. Passed to Mail::Message::Replace::MailHeader::new(FoldLength).
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.
What to do with leading "From " lines in e-mail data. Passed to Mail::Message::Replace::MailHeader::new(MailFrom).
From
Whether to re-fold all the incoming fields. Passed to Mail::Message::Replace::MailHeader::new(Modify).
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);
Your email address.
Extends "Constructing a message" in Mail::Message.
Replaced by sign(), but still usable. $filename is the file which contains the signature, which defaults to $ENV{HOME}/.signature.
$ENV{HOME}/.signature
Inherited, see "Constructing a message" in Mail::Message::Construct::Bounce
Inherited, see "Constructing a message" in Mail::Message::Construct::Build
Read header and body from an ARRAY or $fh
Inherited, see "Constructing a message" in Mail::Message::Construct::Forward
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>
Read only the message's body from the ARRAY or $fh.
Read only the message's header from the ARRAY or $fh
Inherited, see "Constructing a message" in Mail::Message::Construct::Rebuild
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/
Remove the fields witht the specified names from the produced reply message.
Quotation STRING, which is translated into reply(quote). The normal default of quote is "> ", in stead of ">".
quote
Copy all header fields with the specified NAMES from the source to the reply message.
Reply to the group? Translated into reply(group_reply), which has as default the exact oposite of this option, being true.
true
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.
Inherited, see "Constructing a message" in Mail::Message::Construct::Reply
Add a signature (a few extra lines) to the message.
-Option --Default File undef Signature ''
Specifies a filename where the signature is in.
The signature in memory.
Extends "The message" in Mail::Message.
Inherited, see "The message" in Mail::Message
Send an NNTP message (newsgroup message), which is equivalent to Mail::Transport::NNTP or Mail::Message::send() with via 'nntp'.
via 'nntp'
-Option--Default Debug <false> Host <from Net::Config> Port 119
Prints the whole message to the specified $fh, which default to STDOUT. This calls Mail::Message::print().
Send via Mail Transfer Agents (MUA). These will be handled by various Mail::Transport::Send extensions. The test $type is not supported.
test
Extends "The header" in Mail::Message.
Add header lines, which simply calls Mail::Message::Head::add() on the header for each specified LINE. The last added LINE is returned.
Mail::Message::Head::add()
Inherited, see "The header" in Mail::Message
Not to be used, replaced by header().
Not implemented, because I see no use for it.
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...
delete
Calls Mail::Message::Replace::MailHeader::delete()
Fold all the fields to a certain maximum $length. Implemented by Mail::Message::Replace::MailHeader::fold()
Set the maximum line $length. $tag is ignored. Implemented by Mail::Message::Replace::MailHeader::fold_length()
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()
Returns the head of the message, or creates an empty one if none is defined. The $head argument, which sets the header, is not available for Mail::Internet, but is there to be compatible with the head method of Mail::Message.
head
Optionally reads a header from the ARRAY, and then returns those fields as array-ref nicely folded. Implemented by Mail::Message::Replace::MailHeader::header()
Calls Mail::Message::Head::Complete::print().
Adds LINES to the header, but removes fields with the same name if they already exist. Calls Mail::Message::Replace::MailHeader::replace()
No effect anymore (always performed).
Extends "The body" in Mail::Message.
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.
Calls Mail::Message::body(), because that body method is overruled by the one which has a Mail::Internet compatible interface.
body
Inherited, see "The body" in Mail::Message
Prints the body to the specified $fh, which defaults to STDOUT. This calls Mail::Message::Body::print().
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().
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.
smtp
-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
Only the first detected HOSTNAME is taken, so differs from the original implementation.
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.
Removes blank lines from begin and end of the body.
Extends "Flags" in Mail::Message.
Inherited, see "Flags" in Mail::Message
Extends "The whole message as text" in Mail::Message.
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 >.
Inherited, see "The whole message as text" in Mail::Message::Construct::Text
Of course, the isa() class inheritance check should not see our nasty trick.
isa()
Extends "Internals" in Mail::Message.
Inherited, see "Internals" in Mail::Message
Coerce (adapt type) of the specified $message (anything Mail::Message::coerce() accepts) into an Mail::Internet simulating object.
Inherited, see "Internals" in Mail::Message::Construct::Rebuild
Extends "Error handling" in Mail::Message.
Inherited, see "METHODS" in Mail::Message::Construct
Inherited, see "Error handling" in Mail::Reporter
Inherited, see "Error handling" in Mail::Message
Extends "Cleanup" in Mail::Message.
Inherited, see "Cleanup" in Mail::Reporter
Inherited, see "Cleanup" in Mail::Message
Extends "DETAILS" in Mail::Message.
Unknown alternative for the forward(include). Valid choices are NO, INLINE, ATTACH, and ENCAPSULATE.
NO
INLINE
ATTACH
ENCAPSULATE
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).
The message bounce() method forwards a received message off to someone else without modification; you must specified it's new destination. If you have the urge not to specify any destination, you probably are looking for reply(). When you wish to modify the content, use forward().
If a forward message is created, a destination address must be specified.
You may wish to construct a message to be stored in a some kind of folder, but you need to do that in two steps. First, create a normal Mail::Message, and then add it to the folder. During this Mail::Box::addMessage() process, the message will get coerce()-d into the right message type, adding storage information and the like.
Fatal error: the specific package (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package.
This module is part of Mail-Box distribution version 2.112, built on March 14, 2014. Website: http://perl.overmeer.net/mailbox/
Copyrights 2001-2014 by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html
To install Mail::Box, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::Box
CPAN shell
perl -MCPAN -e shell install Mail::Box
For more information on module installation, please visit the detailed CPAN module installation guide.