=head1 NAME Mail::Message::Replace::MailInternet - fake Mail::Internet =head1 INHERITANCE Mail::Message::Replace::MailInternet is a Mail::Message is a Mail::Reporter =head1 SYNOPSIS !!! 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. =head1 DESCRIPTION This module is a wrapper around a L, which simulates a L 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 L and L calls. =head1 OVERLOADED =head1 METHODS =head2 Constructors $obj-EB(OPTIONS) =over 4 See L =back $obj-EB =over 4 Duplicate the message. The result will again be a L compatible object. =back $obj-EB =over 4 Remove all data from this object. Very dangerous! =back Mail::Message::Replace::MailInternet-EB([ARG], [OPTIONS]) =over 4 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 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 trace Mail::Reporter 'WARNINGS' trusted Mail::Message . Body => ARRAY-OF-LINES =over 4 Array of C<"\n"> terminated lines. If not specified, the lines will be read from ARG. =back . FoldLength => INTEGER =over 4 Number of characters permitted on any refolded header line. Passed to L. =back . Header => OBJECT =over 4 The L object, which is passed here, is a fake one as well... It is translated into a L. If not given, the header will be parsed from the ARG. =back . MailFrom => 'IGNORE'|'ERROR'|'COERCE'|'KEEP' =over 4 What to do with leading "C" lines in e-mail data. Passed to L. =back . Modify => BOOLEAN =over 4 Whether to re-fold all the incoming fields. Passed to L. =back . 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); =back =head2 Attributes $obj-EB([STRING]) =over 4 Your email address. =back =head2 Constructing a message $obj-EB([FILENAME]) =over 4 Replaced by L, but still usable. FILENAME is the file which contains the signature, which defaults to C<$ENV{HOME}/.signature>. =back $obj-EB([RG-OBJECT|OPTIONS]) =over 4 See L =back Mail::Message::Replace::MailInternet-EB([MESSAGE|PART|BODY], CONTENT) =over 4 See L =back Mail::Message::Replace::MailInternet-EB(BODY, [HEAD], HEADERS) =over 4 See L =back $obj-EB(ARRAY or FILEHANDLE) =over 4 Read header and body from an ARRAY or FILEHANDLE =back $obj-EB(OPTIONS) =over 4 See L =back $obj-EB(OPTIONS) =over 4 See L =back $obj-EB(OPTIONS) =over 4 See L =back $obj-EB(OPTIONS) =over 4 See L =back $obj-EB(OPTIONS) =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB(STRING) =over 4 See L =back $obj-EB(ARRAY|FILEHANDLE, OPTIONS) Mail::Message::Replace::MailInternet-EB(ARRAY|FILEHANDLE, OPTIONS) =over 4 Read header and body from the specified ARRAY or FILEHANDLE. When used as object method, L 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 . body_type => CLASS . strip_status_fields => BOOLEAN =back $obj-EB(ARRAY|FILEHANDLE) =over 4 Read only the message's body from the ARRAY or FILEHANDLE. =back $obj-EB(ARRAY|FILEHANDLE) =over 4 Read only the message's header from the ARRAY or FILEHANDLE =back $obj-EB(OPTIONS) =over 4 See L =back $obj-EB(OPTIONS) =over 4 BE WARNED: the main job for creating a reply is done by L, which may produce a result which is compatible, but may be different from L'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 ReplyAll Subject Mail::Message::Construct::Reply replySubject() To Mail::Message::Construct::Reply body Mail::Message::Construct::Reply undef group_reply Mail::Message::Construct::Reply 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 =over 4 Remove the fields witht the specified names from the produced reply message. =back . From => ADDRESSES . Inline => STRING =over 4 Quotation STRING, which is translated into L. The normal default of C is "E ", in stead of "E". =back . Keep => ARRAY-OF-NAMES =over 4 Copy all header fields with the specified NAMES from the source to the reply message. =back . Message-ID => STRING . ReplyAll => BOOLEAN =over 4 Reply to the group? Translated into L, which has as default the exact oposite of this option, being C. =back . Subject => STRING|CODE . To => ADDRESSES . body => BODY . group_reply => BOOLEAN . header_template => FILENAME|C =over 4 Read the return header from the template file. When this is explicitly set to C, or the file does not exist, then a header will be created. =back . 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 =back $obj-EB([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS]) =over 4 See L =back $obj-EB(STRING) Mail::Message::Replace::MailInternet-EB(STRING) =over 4 See L =back $obj-EB(OPTIONS) =over 4 Add a signature (a few extra lines) to the message. Option --Default File undef Signature '' . File => FILENAME =over 4 Specifies a filename where the signature is in. =back . Signature => STRING|ARRAY-OF-LINES =over 4 The signature in memory. =back =back =head2 The message $obj-EB =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB(OPTIONS) =over 4 Send an NNTP message (newsgroup message), which is equivalent to Mail::Transport::NNTP or L with C. Option--Default Debug Host Port 119 . Debug => BOOLEAN . Host => HOSTNAME . Port => INTEGER =back $obj-EB([FILEHANDLE]) =over 4 Prints the whole message to the specified FILEHANDLE, which default to STDOUT. This calls L. =back $obj-EB(TYPE, OPTIONS) =over 4 Send via Mail Transfer Agents (MUA). These will be handled by various L extensions. The C TYPE is not supported. =back $obj-EB =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB([FILEHANDLE]) =over 4 See L =back =head2 The header $obj-EB(LINES) =over 4 Add header lines, which simply calls C on the header for each specified LINE. The last added LINE is returned. =back $obj-EB =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB =over 4 Not to be used, replaced by L. =back $obj-EB(TAG, [WITH]) =over 4 Not implemented, because I see no use for it. =back $obj-EB =over 4 See L =back $obj-EB(NAME, [INDEX]]) =over 4 Delete the fields with the specified NAME. The deleted fields are returned. BE WARNED: if no NAME is specified, the C is interpreted as the deletion of the message in a folder, so L will be called. This may have no negative effect at all... Calls L =back $obj-EB =over 4 See L =back $obj-EB([LENGTH]) =over 4 Fold all the fields to a certain maximum LENGTH. Implemented by L =back $obj-EB([[TAG], LENGTH]) =over 4 Set the maximum line LENGTH. TAG is ignored. Implemented by L =back $obj-EB =over 4 See L =back $obj-EB(NAME, [INDEX]) =over 4 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 L =back $obj-EB =over 4 See L =back $obj-EB([HEAD]) =over 4 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 L, but is there to be compatible with the C method of L. =back $obj-EB
([ARRAY]) =over 4 Optionally reads a header from the ARRAY, and then returns those fields as array-ref nicely folded. Implemented by L =back $obj-EB =over 4 See L =back $obj-EB(FILEHANDLE) =over 4 Calls L. =back $obj-EB(TAG, LINE, [INDEX]) =over 4 Adds LINES to the header, but removes fields with the same name if they already exist. Calls L =back $obj-EB =over 4 See L =back $obj-EB(FIELDNAME) =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB =over 4 No effect anymore (always performed). =back $obj-EB =over 4 See L =back $obj-EB =over 4 See L =back =head2 The body $obj-EB([ARRAY-OF-LINES|LIST-OF-LINES]) =over 4 Returns an array of lines, representing the body. With arguments, a new body will be created. In L, the body is not an object but a simple array. BE WARNED: this overrules the L method, which may cause some confusion. Use L to get access to that body's data. =back $obj-EB([BODY]) =over 4 Calls L, because that C method is overruled by the one which has a L compatible interface. =back $obj-EB =over 4 See L =back $obj-EB(OPTIONS) =over 4 See L =back $obj-EB(OPTIONS) =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER]) =over 4 See L =back $obj-EB([FILEHANDLE]) =over 4 Prints the body to the specified FILEHANDLE, which defaults to STDOUT. This calls L. =back $obj-EB([NRLINES]) =over 4 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 L. =back $obj-EB(OPTIONS) =over 4 This method is calling L via C, which is implemented in L. The implementation is slightly different, so this method is not 100% compliant. Option --Default Debug Hello Host $ENV{SMTPHOSTS} or from Net::Config MailFrom $ENV{MAILADDRESS} or $ENV{USER} Port 25 . Debug => BOOLEAN . Hello => STRING . Host => HOSTNAME =over 4 Only the first detected HOSTNAME is taken, so differs from the original implementation. =back . MailFrom => STRING =over 4 Your e-mail address. This simulated L 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. =back . Port => INTEGER =back $obj-EB =over 4 Removes blank lines from begin and end of the body. =back =head2 Flags $obj-EB([BOOLEAN]) =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB =over 4 See L =back $obj-EB