Mail::Mailer(3)
π Mail::Mailer β aka the "send simple emails" king π
okay so bestie, this is Mail::Mailer, from the User Contributed Perl Documentation crew (perl v5.42.0, dated 2024-12-12, iykyk). It sends mail. Simple emails. That's the whole vibe. Let's get into it π
β¨ NAME β¨
Mail::Mailer β send simple emails π
πΈ INHERITANCE πΈ
so it's giving nepo baby, but make it class hierarchy:
Mail::Mailer
is an IO::Handle
π¦ SYNOPSIS π¦
the way you literally just⦠use it:
use Mail::Mailer;
use Mail::Mailer qw(mail); # specifies default mailer
$mailer = Mail::Mailer->new;
$mailer = Mail::Mailer->new($type, @args);
$mailer->open(\%headers);
print $mailer $body;
$mailer->close
or die "couldn't send whole message: $!\n";
π DESCRIPTION π
It sends mail using any of the built-in methods. As the TYPE argument to new(), you can specify any of these icons π:
"sendmail"β uses thesendmailprogram to deliver the mail. classic. iconic. no notes."smtp"β uses thesmtpprotocol via Net::SMTP to deliver the mail. The server you wanna use can be specified in@argslike:
$mailer = Mail::Mailer->new('smtp', Server => $server);
okay so heads up π«Ά: the smtp mailer does not handle Cc and Bcc lines, neither their Resent-* fellows (rude, I know). But the Debug options enables debugging output from Net::SMTP, so you can peek at what's happening π
[added 2.21] You may also use the StartTLS => 1 options to upgrade the connection with STARTTLS. The same for option SSL => 1. secure-ish era β¨
You may also use the Auth => [ $user, $password ] option for SASL authentication. To make this work, you have to install the Authen::SASL distribution yourself β it is not automatically installed. yes, that means you. go install it. π
"smtps"β this option is deprecated when you havelibnet1.28 (2014) and above π
Otherwise: use the smtp over ssl protocol via Net::SMTP::SSL to deliver the mail. Usage is identical to "smtp". You have to install Authen::SASL as well.
$mailer = Mail::Mailer->new('smtps', Server => $server);
"qmail"β uses qmail's qmail-inject program to deliver the mail. retro moment π"testfile"β used for debugging, this displays the data to the file named in$Mail::Mailer::testfile::config{outfile}which defaults to a file named"mailer.testfile". No mail is ever sent. literally just vibes into a file πΈ
"Mail::Mailer" will search for executables in the above order. The default mailer will be the first one found. first come, first slay π
π METHODS π
π§ Constructors π§
Mail::Mailer->new($type, %options)β the$typeis one of the back-end sender implementations, as described in the DESCRIPTION chapter of this manual page. The%optionsare passed to that back-end. straightforward. we love that.$obj->open(HASH)β the HASH consists of key and value pairs, the key being the name of the header field (eg,"To"), and the value being the corresponding contents of the header field. The value can either be a scalar (eg,"gnat@frii.com") or a reference to an array of scalars ("eg, ['gnat@frii.com', 'Tim.Bunce@ig.co.uk']"). so flexible of you, header π
π₯ DETAILS π₯
π ENVIRONMENT VARIABLES π
PERL_MAILERSβ augments/override the build in choice for binary used to send out our mail messages.
Format:
"type1:mailbinary1;mailbinary2;...:type2:mailbinaryX;...:..."
Example: assume you want you use private sendmail binary instead of mailx, one could set PERL_MAILERS to:
"mail:/does/not/exists:sendmail:$HOME/test/bin/sendmail"
On systems which may include : in file names, use | as separator between type-groups.
"mail:c:/does/not/exists|sendmail:$HOME/test/bin/sendmail"
(yes the c:/ thing is real. windows girlies rise π«Ά)
π BUGS π
Not me having to say this but: Mail::Mailer does not help with folding, and does not protect against various web-script hacker attacks β for instance where a new-line is inserted in the content of the field. so like, sanitize your input, bestie. no cap. π¨
fr fr, don't feed it untrusted header values and expect it to save you π
β SEE ALSO β
This module is part of the MailTools distribution, http://perl.overmeer.net/mailtools/. go visit, she's gorgeous β¨
π AUTHORS π
The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance without commitment to further development. (respect the handoff π«‘)
Mail::Capby Gisle Aas<aas@oslonett.no>.Mail::Field::AddrListby Peter Orbaek<poe@cit.dk>.Mail::MailerandMail::Sendby Tim Bunce<Tim.Bunce@ig.co.uk>.
For other contributors see ChangeLog. shoutout to the whole group chat π
π LICENSE π
Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2024 Mark Overmeer <perl@overmeer.net>.
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. legal slay π
and that's the whole page, bestie π¦ mwah π β this lil beauty is perl v5.42.0, dated 2024-12-12, and it's the Mail::Mailer(3) manpage. periodt. π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-MailTools 2.220.0-160000.2.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms