Mail::T...rt::Send(3)

๐Ÿ’Œ NAME

okay bestie, welcome to Mail::Transport::Send โ€” it's a Perl module and its whole entire job is: send a message. that's it. that's the vibe. ๐Ÿ’…

this page is from the User Contributed Perl Documentation set, section 3 of the manual, and yes we're about to go through ALL of it together, no skimming, no skipping, periodt. ๐ŸŽ€


๐ŸŒณ INHERITANCE

the family tree goes like this, and yes it's giving dynasty:

Mail::Transport::Send
  is a Mail::Transport
  is a Mail::Reporter

Mail::Transport::Send is extended by
  Mail::Transport::Exim
  Mail::Transport::Mailx
  Mail::Transport::Qmail
  Mail::Transport::SMTP
  Mail::Transport::Sendmail

so like โ€” it is a Mail::Transport and is a Mail::Reporter, and those five other modules above all extend it. the nepo babies are the whole point here, iykyk. ๐Ÿ‘‘


โœจ SYNOPSIS

here's the whole entire flex, look:

my $message = Mail::Message->new(...);

# Some extensions implement sending:
$message->send;
$message->send(via => 'sendmail');

my $sender = Mail::Transport::SMTP->new(...);
$sender->send($message);

literally that's it. build a message, yeet it. ๐Ÿฆ‹


๐ŸŒธ DESCRIPTION

so the whole point of this module: it sends a message to the destinations as specified in the header. that's the assignment. ๐Ÿซถ

and here's the slay part โ€” Mail::Transport::Send is capable of autodetecting which of the following modules actually work on your system. so you can just call send with no via options and get your message transported. no thinking required, bestie. ๐Ÿ’–

  • Mail::Transport::Sendmail โ€” uses sendmail to process and deliver the mail. this needs the sendmail program installed on your system. and ngl, whether this is an original sendmail or a replacement from Postfix does matter. not me warning you in advance. ๐Ÿ’€
  • Mail::Transport::Exim โ€” uses exim to distribute the message. simple. clean. iconic.
  • Mail::Transport::Qmail โ€” uses qmail-inject to distribute the message. okay go off.
  • Mail::Transport::SMTP โ€” here, Perl is handling mail transport on its own. this is less desired but more portable than sending with sendmail or qmail. the advantage is that this sender is environment independent and easier to configure. however โ€” and this is the part you need to hear โ€” there is no daemon involved, which means your program will just... wait until the message is delivered. and the message is lost when your program is interrupted during delivery (which may take hours to complete). ๐Ÿ˜ญ so like, main character energy but with consequences. be careful.
  • Mail::Transport::Mailx โ€” uses the external mail, mailx, or Mail programs to send the message. usually, the result is poor, because some versions of these programs do not support MIME headers. besides, these programs are known to have exploitable security breaches. not the vibe, lowkey a red flag. ๐Ÿ™ˆ
Extends "DESCRIPTION" in Mail::Transport.

๐Ÿ› ๏ธ METHODS

Extends "METHODS" in Mail::Transport.

๐ŸŽ€ Constructors

Extends "Constructors" in Mail::Transport.

$class->new(%options)

Inherited, see "Constructors" in Mail::Reporter.

here's the whole entire options menu, no substitutions:

-Option    --Defined in     --Default
 executable  Mail::Transport  undef
 hostname    Mail::Transport  'localhost'
 interval    Mail::Transport  30
 password    Mail::Transport  undef
 port        Mail::Transport  undef
 proxy       Mail::Transport  undef
 retry       Mail::Transport  <unlimited>
 timeout     Mail::Transport  120
 username    Mail::Transport  undef
 via         Mail::Transport  'sendmail'
  • executable => $file
  • hostname => $host|\@hosts
  • interval => $span
  • password => $password
  • port => $port
  • proxy => $path
  • retry => $count|undef
  • timeout => $span
  • username => $username
  • via => CLASS|$name

(no descriptions given for these, bestie โ€” the original is being mysterious and honestly, respect. ๐Ÿค)

๐ŸŒˆ Attributes

Extends "Attributes" in Mail::Transport.

๐Ÿ“ฎ Sending mail

$obj->destinations( $message, [$address|\@addresses] )

figures out the destination for this message. and here's the rules:

if a valid $address is defined, it's used to overrule the addresses within the message. if the $address is undef, it gets ignored (rude but okay). it may also be an ARRAY of @addresses. โœจ

if no $address is specified, the message gets scanned for resent groups (see Mail::Message::Head::Complete::resentGroups()). the addresses found in the first (which is the latest added) group are used. and if no resent groups are found at all? then the normal To, Cc, and Bcc lines are taken. the way that fallback chain just works. ๐Ÿ’…

$obj->putContent($message, $fh, %options)

prints the content of the $message to the $fh. ๐Ÿ–จ๏ธ

heads up: the content might not end with a new-line. see Mail::Message::endsOnNewline().

-Option     --Default
 body_only    false
 undisclosed  false
  • body_only => BOOLEAN โ€” print only the body of the message, not the whole thing. just the goods.
  • undisclosed => BOOLEAN โ€” do not print the Bcc and Resent-Bcc lines. the default is false, which means that they are not printed. (yes, read that twice, we said what we said. ๐Ÿ‘€)

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

the main event. ๐ŸŽค transmits the $message, which may be anything that can be coerced into a Mail::Message โ€” so that includes Mail::Internet and MIME::Entity messages too. flexible queen. it returns true when the transmission was successfully completed. โœ…

-Option  --Default
 interval  new(interval)
 retry     new(retry)
 to        undef
  • interval => SECONDS
  • retry => INTEGER
  • to => STRING โ€” overrules the destination(s) of the message, which by default is taken from the (Resent-)To, (Resent-)Cc, and (Resent-)Bcc.

$obj->trySend($message, %options)

tries to send the message. it returns true if it worked, and false in case some problems were detected. also, $? contains the exit status of the command which was started. so like, you always know what happened. ๐Ÿ•ต๏ธโ€โ™€๏ธ

๐Ÿ”Œ Server connection

Extends "Server connection" in Mail::Transport.
  • $obj->findBinary( $name, [@directories] ) โ€” inherited, see "Server connection" in Mail::Transport.
  • $obj->remoteHost() โ€” inherited, see "Server connection" in Mail::Transport.
  • $obj->retry() โ€” inherited, see "Server connection" in Mail::Transport.

๐Ÿšจ Error handling

Extends "Error handling" in Mail::Transport.
  • $obj->AUTOLOAD() โ€” inherited, see "Error handling" in Mail::Reporter.
  • $obj->notImplemented() โ€” inherited, see "Error handling" in Mail::Reporter.

๐Ÿงน Cleanup

Extends "Cleanup" in Mail::Transport.
  • $obj->DESTROY() โ€” inherited, see "Cleanup" in Mail::Reporter.

๐Ÿ’€ DIAGNOSTICS

listen up, this is the part where things go wrong and we learn from it. ๐ŸŒˆ

Error: class $package does not implement method $method.

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. Cast by notImplemented().

Warning: message has no destination.

it was not possible to figure-out where the message is intended to go to. ๐Ÿ˜ญ Cast by destinations().

Warning: resent group does not specify a destination.

the message which is sent is the result of a bounce (for instance created with Mail::Message::bounce()), and therefore starts with a Received header field. with the bounce, the new destination(s) of the message are given, which should be included as Resent-To, Resent-Cc, and Resent-Bcc. ๐ŸŽฏ

the To, Cc, and Bcc header information is only used if no Received was found. that seems to be the best explanation of the RFC. ๐Ÿซก

as an alternative, you may also specify the to option to some of the senders (for instance Mail::Transport::SMTP::send(to) to overrule any information found in the message itself about the destination. Cast by destinations().

Error: transporters of type $class cannot send.

the Mail::Transport object of the specified type can not send messages, but only receive messages. so like, wrong girl for the job. Cast by trySend().


๐Ÿ‘€ SEE ALSO

this module is part of Mail-Transport version 4.01, built on December 13, 2025. ๐ŸŒŸ Website: http://perl.overmeer.net/CPAN/


๐Ÿ“œ LICENSE

for contributors see file ChangeLog. ๐Ÿ’–

this software is copyright (c) 2001-2025 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. periodt. ๐Ÿ’…


and that's the whole page bestie, we ate and left no crumbs ๐Ÿ“ โ€” this was Mail::Transport::Send(3) from the User Contributed Perl Documentation, rendered with perl v5.42.0 on 2026-01-17. mwah, go send some mail. ๐ŸŽ€โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from