Mail::M...nternet(3)
β¨ Mail::Message::Replace::MailInternet(3) β¨
okay bestie, buckle UP β this is the manual page for Mail::Message::Replace::MailInternet, straight out of the User Contributed Perl Documentation. π«Ά
π NAME π
Mail::Message::Replace::MailInternet β it's a fake Mail::Internet, no cap. Like, cosplaying as the original so hard you can't even tell. π
πΈ INHERITANCE πΈ
Lowkey a whole family tree. Here's the tea:
Mail::Message::Replace::MailInternet
is a Mail::Message
is a Mail::Reporter
π¦ SYNOPSIS π¦
Bestie, it's a find-and-replace moment. Watch:
# 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.
That's it. Swap one line and your old code keeps on slaying, except now it's got all the Mail::Message features underneath. π
β¨ DESCRIPTION β¨
So here's what's happening. This module is a wrapper around a Mail::Message, and what it does is simulate a Mail::Internet object. The name-space of that module gets straight-up hijacked (iconic behavior honestly) and a whole bunch of methods get added on top.
Most methods will work with zero changes on your end β no edits, no drama. But you may need to peek at your smtpsend() and send() calls, just saying. π
It also extends "DESCRIPTION" in Mail::Message.
π₯ OVERLOADED π₯
(nothing under here, it just vibes)
π METHODS π
Extends "METHODS" in Mail::Message.
π Constructors π
Extends "Constructors" in Mail::Message.
$obj->clone(%options)β Inherited, see"Constructors"in Mail::Message.$obj->dup()β Duplicate the message. And guess what, the result is again aMail::Internetcompatible object. So it stays in character. π$obj->empty()β Remove all data from this object. Very dangerous! Like, delete-everything levels of dangerous. π$class->new( [$arg], [%options] )β Inherited, see"Constructors"in Mail::Reporter.
Here's the option table, exactly as it is:
-Option --Defined in --Default
Body undef
FoldLength 79
Header undef
MailFrom 'KEEP'
Modify false
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 +{}
messageId Mail::Message undef
modified Mail::Message false
trusted Mail::Message false
Now let's break those down, bestie:
Body => \@linesβ An array of"\n"terminated lines. If you don't specify it, the lines get read from$arg. Easy peasy.FoldLength => $octetsβ How many characters (encoded$octets) are allowed on any refolded header line. This gets passed along toMail::Message::Replace::MailHeader::new(FoldLength).Header => $headβ TheMail::Headerobject you pass here is a fake one too, ngl... It gets translated into anew(head). If you don't give one, the header gets parsed from the$arg.MailFrom => 'IGNORE'|'ERROR'|'COERCE'|'KEEP'β What to do with leading"From "lines in e-mail data. Passed toMail::Message::Replace::MailHeader::new(MailFrom).Modify => BOOLEANβ Whether to re-fold all the incoming fields. Passed toMail::Message::Replace::MailHeader::new(Modify).body => $objectbody_type => $classdeleted => BOOLEANfield_type => $classhead => $objecthead_type => $classlabels => \@pairs|\%settingsmessageId => $idmodified => BOOLEANtrusted => 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);
Look at that glow-up. Same call, new energy. β¨
π§ Attributes π§
Extends "Attributes" in Mail::Message.
$obj->MailFrom( [STRING] )β Your email address. That's the whole thing. π
π Constructing a message π
Extends "Constructing a message" in Mail::Message.
$obj->add_signature( [$filename] )β Replaced bysign(), but still usable.$filenameis the file which contains the signature, and it defaults to"$ENV{HOME}/.signature".$obj->bounce( [<$rg_object|%options>] )β Inherited, see"Constructing a message"in Mail::Message::Construct::Bounce.$class->build( [$message|$part|$body], @fields, %options )β Inherited, see"Constructing a message"in Mail::Message::Construct::Build.$class->buildFromBody($body, [$head], $headers)β Inherited, see"Constructing a message"in Mail::Message::Construct::Build.$obj->extract(\@lines|$fh)β Read header and body from an ARRAY or$fh.$obj->forward(%options)β Inherited, see"Constructing a message"in Mail::Message::Construct::Forward.$obj->forwardAttach(%options)β Inherited, see"Constructing a message"in Mail::Message::Construct::Forward.$obj->forwardEncapsulate(%options)β Inherited, see"Constructing a message"in Mail::Message::Construct::Forward.$obj->forwardInline(%options)β Inherited, see"Constructing a message"in Mail::Message::Construct::Forward.$obj->forwardNo(%options)β Inherited, see"Constructing a message"in Mail::Message::Construct::Forward.$obj->forwardPostlude()β Inherited, see"Constructing a message"in Mail::Message::Construct::Forward.$obj->forwardPrelude()β Inherited, see"Constructing a message"in Mail::Message::Construct::Forward.$obj->forwardSubject(STRING)β Inherited, see"Constructing a message"in Mail::Message::Construct::Forward.$any->read(\@lines|$fh, %options)β Read header and body from the specified ARRAY or$fh. When you use it as an object method,Mail::Message::read()gets called, so it stays MailBox compliant. As a class method, theMail::Internetcompatible read is called instead. Heads up:%optionsare only available in the first case. Improves base, see"Constructing a message"in Mail::Message::Construct::Read.
Option table for read, verbatim:
-Option --Defined in --Default
body_type Mail::Message::Construct::Read undef
parser_class Mail::Message::Construct::Read undef
seekable Mail::Message::Construct::Read false
strip_status_fields Mail::Message::Construct::Read true
trusted Mail::Message::Construct::Read true
body_type => $typeparser_class => $typeseekable => BOOLEANstrip_status_fields => BOOLEANtrusted => BOOLEAN$obj->read_body(\@lines|$fh)β Read only the message's body from the ARRAY or$fh.$obj->read_header(\@lines|$fh)β Read only the message's header from the ARRAY or$fh.$obj->rebuild(%options)β Inherited, see"Constructing a message"in Mail::Message::Construct::Rebuild.$obj->reply(%options)β BE WARNED: the main job for creating a reply is done byMail::Message::reply(), which may produce a result which is compatible, but may be different fromMail::Internet's version. Improves base, see"Constructing a message"in Mail::Message::Construct::Reply.
Option table for reply, exactly:
-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 <C<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/
And the breakdown:
Bcc => $body|$address|\@addressesCc => $body|$address|\@addressesExclude => \@namesβ Remove the fields with the specified names from the produced reply message.From => $body|$address|\@addressesInline => STRINGβ QuotationSTRING, which is translated intoreply(quote). The normal default of"quote"is"> ", in stead of">".Keep => \@namesβ Copy all header fields with the specified NAMES from the source to the reply message.Message-ID => STRINGReplyAll => BOOLEANβ Reply to the group? Translated intoreply(group_reply), which has as default the exact oposite of this option, being"true".Subject => STRING|CODETo => $body|$address|\@addressesbody => $bodygroup_reply => BOOLEANheader_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 => INTEGERmessage_type => CLASSpostlude => $body|\@linesprelude => $body|\@linesquote => CODE|STRINGsignature => $body|$messagestrip_signature => REGEXP|STRING|CODE$obj->replyPrelude( [STRING|$field|$address|\@addrs|\@fields] )β Inherited, see"Constructing a message"in Mail::Message::Construct::Reply.$any->replySubject(STRING)β Inherited, see"Constructing a message"in Mail::Message::Construct::Reply.$obj->sign(%options)β Add a signature (a few extra lines) to the message. π
Option table for sign:
-Option --Default
File undef
Signature ''
File => $filenameβ Specifies a filename where the signature is in.Signature => STRING|\@linesβ The signature in memory.
π The message π
Extends "The message" in Mail::Message.
$obj->container()β Inherited, see"The message"in Mail::Message.$obj->endsOnNewline()β Inherited, see"The message"in Mail::Message.$obj->isDummy()β Inherited, see"The message"in Mail::Message.$obj->isPart()β Inherited, see"The message"in Mail::Message.$obj->messageId()β Inherited, see"The message"in Mail::Message.$obj->partNumber()β Inherited, see"The message"in Mail::Message.$obj->print( [$fh] )β Spits the whole message out to the$fhyou hand it, and if you don't hand it one it defaults toSTDOUT. Under the hood it callsMail::Message::print(). Improves base, see "The message" in Mail::Message.$obj->send($type, %options)β Sends your message out through Mail Transfer Agents (MUA) π¦ β the actual delivery gets handled by a whole lil squad ofMail::Transport::Sendextensions. Heads up tho: the"test"$type is not supported. Improves base, see "The message" in Mail::Message.$obj->size()β β¨ Inherited, see "The message" in Mail::Message.$obj->toplevel()β β¨ Inherited, see "The message" in Mail::Message.$obj->write( [$fh] )β β¨ Inherited, see "The message" in Mail::Message.
π The header π
Extends "The header" in Mail::Message.
$obj->add(\@lines)β Adds header lines, which honestly just callsMail::Message::Head::add()on the header once for everyLINEyou passed in. The lastLINEthat got added is what comes back to you π$obj->bcc()β β¨ Inherited, see "The header" in Mail::Message.$obj->cc()β β¨ Inherited, see "The header" in Mail::Message.$obj->clean_header()β Not to be used, it got replaced byheader().$obj->combine( $tag, [$with] )β Not implemented, because the author genuinely sees no use for it π$obj->date()β β¨ Inherited, see "The header" in Mail::Message.$obj->delete( $name, [$index]] )β Deletes the fields carrying that$name, and hands the deleted fields right back to you.
BE WARNED: if you don't specify a$name, the"delete"gets read as deleting the whole message out of a folder, soMail::Box::Message::delete()will get called instead π This may have no negative effect at all...
Calls Mail::Message::Replace::MailHeader::delete(). Improves base, see "Flags" in Mail::Message.
$obj->destinations()β β¨ Inherited, see "The header" in Mail::Message.$obj->fold( [$length] )β Folds every field down to a certain maximum$length. Implemented byMail::Message::Replace::MailHeader::fold().$obj->fold_length( [[$tag], $length] )β Sets that maximum line$length. The$tag? ignored, bestie. Implemented byMail::Message::Replace::MailHeader::fold_length().$obj->from()β β¨ Inherited, see "The header" in Mail::Message.$obj->get( $name, [$index] )β Grabs every header field matching that$name. In scalar context, only the first fitting$namecomes back. And even when you only name one$name, you can still get multiple lines back β because some fields just show up more than once in a header, that's their whole vibe πΈ CallsMail::Message::Replace::MailHeader::get(). Improves base, see "The header" in Mail::Message.$obj->guessTimestamp()β β¨ Inherited, see "The header" in Mail::Message.$obj->head( [$head] )β Returns the head of the message, or makes an empty one if none is defined yet. The$headargument β which sets the header β is not available for Mail::Internet, it's only there so things stay compatible with the"head"method over inMail::Message. Improves base, see "The header" in Mail::Message.$obj->header( [\@lines] )β Optionally reads a header in from that ARRAY of lines, then returns those fields as an array-ref, nicely folded π«Ά Implemented byMail::Message::Replace::MailHeader::header().$obj->nrLines()β β¨ Inherited, see "The header" in Mail::Message.$obj->print_header($fh)β CallsMail::Message::Head::Complete::print().$obj->replace( $tag, $line, [$index] )β AddsLINESto the header, but yeets any fields with the same name if they're already hanging around. CallsMail::Message::Replace::MailHeader::replace().$obj->sender()β β¨ Inherited, see "The header" in Mail::Message.$obj->study($fieldname)β β¨ Inherited, see "The header" in Mail::Message.$obj->subject()β β¨ Inherited, see "The header" in Mail::Message.$obj->tidy_headers()β No effect anymore (it's always performed).$obj->timestamp()β β¨ Inherited, see "The header" in Mail::Message.$obj->to()β β¨ Inherited, see "The header" in Mail::Message.
π¦ The body π¦
Extends "The body" in Mail::Message.
$obj->body($lines|@lines)β Returns an ARRAY of lines that represents the body. Pass arguments and a brand new body gets created instead. Fun fact: inMail::Internet, the body isn't an object at all β it's just a plain old array π
BE WARNED: this overrules theMail::Message::body()method, which can cause some real confusion. UsebodyObject()if you want access to that body's data. Improves base, see "The body" in Mail::Message.
$obj->bodyObject( [$body] )β CallsMail::Message::body(), because that"body"method got overruled by the one with theMail::Internet-compatible interface.$obj->contentType()β β¨ Inherited, see "The body" in Mail::Message.$obj->decoded(%options)β β¨ Inherited, see "The body" in Mail::Message.$obj->encode(%options)β β¨ Inherited, see "The body" in Mail::Message.$obj->isMultipart()β β¨ Inherited, see "The body" in Mail::Message.$obj->isNested()β β¨ Inherited, see "The body" in Mail::Message.$obj->parts( [<'ALL'|'ACTIVE'|'DELETED'|'RECURSE'|$filter>] )β β¨ Inherited, see "The body" in Mail::Message.$obj->print_body( [$fh] )β Prints the body out to$fh, which defaults toSTDOUT. CallsMail::Message::Body::print().$obj->remove_sig( [$nrlines] )β Removes the signature off a message with a max of$nrlineslines, defaulting to10. The work happens on the decoded body content, done byMail::Message::Body::stripSignature().$obj->smtpsend(%options)β This one callsMail::Message::send()via"smtp", which is implemented inMail::Transport::SMTP. Ngl 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 gets taken, so this differs from the original implementation.
MailFrom => STRING Your e-mail address. This simulated Mail::Internet object does not try to cook up an e-mail address from the sendmail configuration file, because that's generally a bad idea in environments with virtual hosts, as we have now-adays π
Port => INTEGER
$obj->tidy_body()β Removes blank lines from the begin and end of the body β¨
π Flags π
Extends "Flags" in Mail::Message.
$obj->deleted( [BOOLEAN] )β β¨ Inherited, see "Flags" in Mail::Message.$obj->isDeleted()β β¨ Inherited, see "Flags" in Mail::Message.$obj->isModified()β β¨ Inherited, see "Flags" in Mail::Message.$obj->label($label|PAIRS)β β¨ Inherited, see "Flags" in Mail::Message.$obj->labels()β β¨ Inherited, see "Flags" in Mail::Message.$obj->labelsToStatus()β β¨ Inherited, see "Flags" in Mail::Message.$obj->modified( [BOOLEAN] )β β¨ Inherited, see "Flags" in Mail::Message.$obj->statusToLabels()β β¨ Inherited, see "Flags" in Mail::Message.
π The whole message as text π
Extends "The whole message as text" in Mail::Message.
$obj->as_mbox_string()β Returns the whole message as one single string, ready to be included in an MBOX folder (while not usingMail::Box::Mbox). Any lines in the body that start with"From "get escaped with a>π«Ά$obj->file()β β¨ Inherited, see "The whole message as text" inMail::Message::Construct::Text.$obj->lines()β β¨ Inherited, see "The whole message as text" inMail::Message::Construct::Text.$obj->printStructure( [$fh|undef],[$indent] )β β¨ Inherited, see "The whole message as text" inMail::Message::Construct::Text.$obj->string()β β¨ Inherited, see "The whole message as text" inMail::Message::Construct::Text.
π The nasty bits π
$any->isa($class)β Obviously theisa()class inheritance check should not be seeing our nasty lil trick π
π§ Internals π§
Extends "Internals" in Mail::Message.
$obj->clonedFrom()β β¨ Inherited, see "Internals" in Mail::Message.$class->coerce($message)β Coerces (adapts the type of) that$messageβ anythingMail::Message::coerce()accepts β into anMail::Internet-simulating object. Improves base, see "Internals" in Mail::Message.$obj->isDelayed()β β¨ Inherited, see "Internals" in Mail::Message.$obj->readBody( $parser, $head, [$bodytype] )β β¨ Inherited, see "Internals" in Mail::Message.$obj->readFromParser( $parser, [$bodytype] )β β¨ Inherited, see "Internals" in Mail::Message.$obj->readHead( $parser, [$class] )β β¨ Inherited, see "Internals" in Mail::Message.$obj->recursiveRebuildPart($part, %options)β β¨ Inherited, see "Internals" inMail::Message::Construct::Rebuild.$obj->storeBody($body)β β¨ Inherited, see "Internals" in Mail::Message.$obj->takeMessageId( [STRING] )β β¨ Inherited, see "Internals" in Mail::Message.
π Error handling π
Extends "Error handling" in Mail::Message.
$obj->AUTOLOAD()β β¨ Inherited, see "METHODS" inMail::Message::Construct.$obj->notImplemented()β β¨ Inherited, see "Error handling" inMail::Reporter.$any->shortSize( [$value] )β β¨ Inherited, see "Error handling" in Mail::Message.$obj->shortString()β β¨ Inherited, see "Error handling" in Mail::Message.
π Cleanup π
Extends "Cleanup" in Mail::Message.
$obj->DESTROY()β β¨ Inherited, see "Cleanup" inMail::Reporter.$obj->destruct()β β¨ Inherited, see "Cleanup" in Mail::Message.
β DETAILS β
Extends "DETAILS" in Mail::Message.
π DIAGNOSTICS π
okay bestie, this is the part where the module yells at you. Every single one of these is a real message you might see, and they all mean business, so let's go one by one π
Error: Cannot include forward source as $kind.β you tried toforward(include)with something that isn't a real choice. The only valid options are"NO","INLINE","ATTACH", and"ENCAPSULATE". Cast byforward()β¨Error: Mail::Internet does not support $what data.β the only data types allowed are a file handle or anARRAY. Anything else? nope, not supported (peepread()if you want to do more). Cast bynew()π«ΆError: class $package does not implement method $method.β this one's fatal, bestie π the specific$package(or one of its superclasses) just does not implement this method, even though it really should. What it means: some other related classes do implement it, but this one doesn't. So likeβ¦ investigate, and probably tell the author of the package. Cast bynotImplemented()Error: method bounce requires To, Cc, or Bcc.βbounce()forwards a received message off to someone else with zero modification, so you must specify its new destination. If you're feeling like not specifying a destination, you're actually looking forreply(). And if you wanna modify the content? that'sforward(). Cast bybounce()πError: method forwardAttach requires a preamble.β Cast byforwardAttach()Error: method forwardEncapsulate requires a preamble.β Cast byforwardEncapsulate()Error: method forwardNo requires a To.β Cast byforwardNo()Error: method forwardNo requires a body.β Cast byforwardNo()Error: no rebuild rule $name defined.β Cast byrebuild()Error: only build() Mail::Message's; they are not in a folder yet.β so you wanna construct a message to be stored in some kind of folder, but bestie you gotta do it in two steps. First, create a normalMail::Message, and then add it to the folder. During thatMail::Box::addMessage()process, the message getscoerce()-d into the right message type, storage information and all that good stuff gets added. Cast bybuild()πΈError: select parts via '$what'?β Cast byparts()Warning: skipped unknown key '$key' in build.β Cast bybuild()
π SEE ALSO π
This module is part of Mail-Message version 4.04, built on February 04, 2026. Website: http://perl.overmeer.net/CPAN/ π¦
π LICENSE π
For contributors see file ChangeLog.
This software is copyright (c) 2001-2026 by Mark Overmeer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay π
and that's the whole page bestie!! this was Mail::M...nternet(3) from perl v5.42.0, dated 2026-02-05 β tysm for reading, go forth and email responsibly ππ
β¨
π¦ where this page comes from
- fedora 44: perl-Mail-Message 4.04-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms