{"id":6633,"date":"2022-12-20T19:19:29","date_gmt":"2022-12-20T22:19:29","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/mailmailer-man3\/"},"modified":"2022-12-20T19:19:29","modified_gmt":"2022-12-20T22:19:29","slug":"mailmailer-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/mailmailer-man3\/","title":{"rendered":"Mail::Mailer (man3)"},"content":{"rendered":"<h1 align=\"center\">Mail::Mailer<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#INHERITANCE\">INHERITANCE<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#METHODS\">METHODS<\/a><br \/> <a href=\"#DETAILS\">DETAILS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#AUTHORS\">AUTHORS<\/a><br \/> <a href=\"#LICENSE\">LICENSE<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Mail::Mailer \u2212 send simple emails<\/p>\n<h2>INHERITANCE <a name=\"INHERITANCE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Mail::Mailer <br \/> is an IO::Handle<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">use Mail::Mailer; <br \/> use Mail::Mailer qw(mail); # specifies default mailer <br \/> $mailer = Mail::Mailer\u2212>new; <br \/> $mailer = Mail::Mailer\u2212>new($type, @args); <br \/> $mailer\u2212>open(%headers); <br \/> print $mailer $body; <br \/> $mailer\u2212>close <br \/> or die &#8220;couldn&#8217;t send whole message: $!n&#8221;;<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Sends mail using any of the built-in methods. As <small>TYPE<\/small> argument to <b>new()<\/b>, you can specify any of <br \/> &#8220;sendmail&#8221;<\/p>\n<p style=\"margin-left:17%;\">Use the &#8220;sendmail&#8221; program to deliver the mail.<\/p>\n<p style=\"margin-left:11%;\">&#8220;smtp&#8221;<\/p>\n<p style=\"margin-left:17%;\">Use the &#8220;smtp&#8221; protocol via Net::SMTP to deliver the mail. The server to use can be specified in @args with<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">$mailer = Mail::Mailer\u2212>new(&#8216;smtp&#8217;, Server => $server);<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The smtp mailer does not handle &#8220;Cc&#8221; and &#8220;Bcc&#8221; lines, neither their &#8220;Resent\u2212*&#8221; fellows. The &#8220;Debug&#8221; options enables debugging output from &#8220;Net::SMTP&#8221;.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">[added 2.21] You may also use the &#8220;StartTLS => 1&#8221; options to upgrade the connection with <small>STARTTLS.<\/small> You need &#8220;libnet&#8221; version 1.28 (2014) for this to work.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">You may also use the &#8220;Auth => [ $user, $password ]&#8221; option for <small>SASL<\/small> authentication. To make this work, you have to install the Authen::SASL distribution yourself: it is not automatically installed.<\/p>\n<p style=\"margin-left:11%;\">&#8220;smtps&#8221;<\/p>\n<p style=\"margin-left:17%;\">This option is <b>deprecated<\/b> when you have &#8220;libnet&#8221; 1.28 (2014) and above.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Use the smtp over ssl protocol via Net::SMTP::SSL to deliver the mail. Usage is identical to &#8220;smtp&#8221;. You have to install Authen::SASL as well.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">$mailer = Mail::Mailer\u2212>new(&#8216;smtps&#8217;, Server => $server);<\/p>\n<p style=\"margin-left:11%;\">&#8220;qmail&#8221;<\/p>\n<p style=\"margin-left:17%;\">Use qmail\u2019s qmail-inject program to deliver the mail.<\/p>\n<p style=\"margin-left:11%;\">&#8220;testfile&#8221;<\/p>\n<p style=\"margin-left:17%;\">Used for debugging, this displays the data to the file named in $Mail::Mailer::testfile::config{outfile} which defaults to a file named &#8220;mailer.testfile&#8221;. No mail is ever sent.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">&#8220;Mail::Mailer&#8221; will search for executables in the above order. The default mailer will be the first one found.<\/p>\n<h2>METHODS <a name=\"METHODS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Constructors<\/b> <br \/> Mail::Mailer\u2212><b>new<\/b>($type, %options)<\/p>\n<p style=\"margin-left:17%;\">The $type is one of the back-end sender implementations, as described in the <small>DESCRIPTION<\/small> chapter of this manual page. The %options are passed to that back-end.<\/p>\n<p style=\"margin-left:11%;\">$obj\u2212><b>open<\/b>( <small>HASH<\/small> )<\/p>\n<p style=\"margin-left:17%;\">The <small>HASH<\/small> consists of key and value pairs, the key being the name of the header field (eg, &#8220;To&#8221;), and the value being the corresponding contents of the header field. The value can either be a scalar (eg, &#8220;gnat@frii.com&#8221;) or a reference to an array of scalars (&#8220;eg, [&#8216;gnat@frii.com&#8217;, &#8216;Tim.Bunce@ig.co.uk&#8217;]&#8221;).<\/p>\n<h2>DETAILS <a name=\"DETAILS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b><small>ENVIRONMENT VARIABLES<\/small><\/b> <small><br \/> PERL_MAILERS<\/small><\/p>\n<p style=\"margin-left:17%;\">Augments\/override the build in choice for binary used to send out our mail messages.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Format:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">&#8220;type1:mailbinary1;mailbinary2;&#8230;:type2:mailbinaryX;&#8230;:&#8230;&#8221;<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Example: assume you want you use private sendmail binary instead of mailx, one could set &#8220;PERL_MAILERS&#8221; to:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">&#8220;mail:\/does\/not\/exists:sendmail:$HOME\/test\/bin\/sendmail&#8221;<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">On systems which may include &#8220;:&#8221; in file names, use &#8220;|&#8221; as separator between type-groups.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">&#8220;mail:c:\/does\/not\/exists|sendmail:$HOME\/test\/bin\/sendmail&#8221;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b><small>BUGS<\/small><\/b> <br \/> 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.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This module is part of the MailTools distribution, <i>http:\/\/perl.overmeer.net\/mailtools\/<\/i>.<\/p>\n<h2>AUTHORS <a name=\"AUTHORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance without commitment to further development.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.<\/p>\n<h2>LICENSE <a name=\"LICENSE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Copyrights 1995\u22122000 Graham Barr <gbarr@pobox.com> and 2001\u22122017 Mark Overmeer <perl@overmeer.net>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This program is free software; you can redistribute it and\/or modify it under the same terms as Perl itself. See <i>http:\/\/www.perl.com\/perl\/misc\/Artistic.html<\/i><\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  Mail::Mailer \u2212 send simple emails <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3014,3007],"class_list":["post-6633","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-mailmailer","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6633"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6633\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}