333 lines
6.9 KiB
HTML
333 lines
6.9 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Mail::Mailer</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Mail::Mailer</H1>
|
|
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2019-07-25<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Mail::Mailer - send simple emails
|
|
<A NAME="lbAC"> </A>
|
|
<H2>INHERITANCE</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
Mail::Mailer
|
|
is an IO::Handle
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
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";
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
Sends mail using any of the built-in methods. As <FONT SIZE="-1">TYPE</FONT> argument
|
|
to <B>new()</B>, you can specify any of
|
|
<DL COMPACT>
|
|
<DT id="1">"sendmail"<DD>
|
|
|
|
|
|
|
|
|
|
Use the <TT>"sendmail"</TT> program to deliver the mail.
|
|
<DT id="2">"smtp"<DD>
|
|
|
|
|
|
|
|
|
|
Use the <TT>"smtp"</TT> protocol via Net::SMTP to deliver the mail. The server
|
|
to use can be specified in <TT>@args</TT> with
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
$mailer = Mail::Mailer->new('smtp', Server => $server);
|
|
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
|
|
The smtp mailer does not handle <TT>"Cc"</TT> and <TT>"Bcc"</TT> lines, neither their
|
|
<TT>"Resent-*"</TT> fellows. The <TT>"Debug"</TT> options enables debugging output
|
|
from <TT>"Net::SMTP"</TT>.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
[added 2.21] You may also use the <TT>"StartTLS => 1"</TT> options to upgrade the
|
|
connection with <FONT SIZE="-1">STARTTLS.</FONT> You need <TT>"libnet"</TT> version 1.28 (2014) for this
|
|
to work.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
You may also use the <TT>"Auth => [ $user, $password ]"</TT> option for <FONT SIZE="-1">SASL</FONT>
|
|
authentication. To make this work, you have to install the Authen::SASL
|
|
distribution yourself: it is not automatically installed.
|
|
<DT id="3">"smtps"<DD>
|
|
|
|
|
|
|
|
|
|
This option is <B>deprecated</B> when you have <TT>"libnet"</TT> 1.28 (2014) and above.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Use the smtp over ssl protocol via Net::SMTP::SSL to deliver the mail.
|
|
Usage is identical to <TT>"smtp"</TT>. You have to install Authen::SASL as
|
|
well.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
$mailer = Mail::Mailer->new('smtps', Server => $server);
|
|
|
|
</PRE>
|
|
|
|
|
|
<DT id="4">"qmail"<DD>
|
|
|
|
|
|
|
|
|
|
Use qmail's qmail-inject program to deliver the mail.
|
|
<DT id="5">"testfile"<DD>
|
|
|
|
|
|
|
|
|
|
Used for debugging, this displays the data to the file named in
|
|
<TT>$Mail::Mailer::testfile::config{outfile}</TT> which defaults to a file
|
|
named <TT>"mailer.testfile"</TT>. No mail is ever sent.
|
|
</DL>
|
|
<P>
|
|
|
|
<TT>"Mail::Mailer"</TT> will search for executables in the above order. The
|
|
default mailer will be the first one found.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>METHODS</H2>
|
|
|
|
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Constructors</H3>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="6">Mail::Mailer-><B>new</B>($type, %options)<DD>
|
|
|
|
|
|
|
|
|
|
The <TT>$type</TT> is one of the back-end sender implementations, as described in
|
|
the <FONT SIZE="-1">DESCRIPTION</FONT> chapter of this manual page. The <TT>%options</TT> are passed to
|
|
that back-end.
|
|
<DT id="7">$obj-><B>open</B>(<FONT SIZE="-1">HASH</FONT>)<DD>
|
|
|
|
|
|
|
|
|
|
The <FONT SIZE="-1">HASH</FONT> consists of key and value pairs, the key being the name of
|
|
the header field (eg, <TT>"To"</TT>), and the value being the corresponding
|
|
contents of the header field. The value can either be a scalar
|
|
(eg, <TT>"<A HREF="mailto:gnat@frii.com">gnat@frii.com</A>"</TT>) or a reference to an array of scalars
|
|
(<TT>"eg, ['<A HREF="mailto:gnat@frii.com">gnat@frii.com</A>', '<A HREF="mailto:Tim.Bunce@ig.co.uk">Tim.Bunce@ig.co.uk</A>']"</TT>).
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>DETAILS</H2>
|
|
|
|
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H3><FONT SIZE="-1">ENVIRONMENT VARIABLES</FONT></H3>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="8"><FONT SIZE="-1">PERL_MAILERS</FONT><DD>
|
|
|
|
|
|
Augments/override the build in choice for binary used to send out
|
|
our mail messages.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Format:
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
"type1:mailbinary1;mailbinary2;...:type2:mailbinaryX;...:..."
|
|
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Example: assume you want you use private sendmail binary instead
|
|
of mailx, one could set <TT>"PERL_MAILERS"</TT> to:
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
"mail:/does/not/exists:sendmail:$HOME/test/bin/sendmail"
|
|
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
|
|
On systems which may include <TT>":"</TT> in file names, use <TT>"|"</TT> as separator
|
|
between type-groups.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
"mail:c:/does/not/exists|sendmail:$HOME/test/bin/sendmail"
|
|
|
|
</PRE>
|
|
|
|
|
|
</DL>
|
|
<A NAME="lbAJ"> </A>
|
|
<H3><FONT SIZE="-1">BUGS</FONT></H3>
|
|
|
|
|
|
|
|
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.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
This module is part of the MailTools distribution,
|
|
<I><A HREF="http://perl.overmeer.net/mailtools/">http://perl.overmeer.net/mailtools/</A></I>.
|
|
<A NAME="lbAL"> </A>
|
|
<H2>AUTHORS</H2>
|
|
|
|
|
|
|
|
The MailTools bundle was developed by Graham Barr. Later, Mark
|
|
Overmeer took over maintenance without commitment to further development.
|
|
<P>
|
|
|
|
Mail::Cap by Gisle Aas <<A HREF="mailto:aas@oslonett.no">aas@oslonett.no</A>>.
|
|
Mail::Field::AddrList by Peter Orbaek <<A HREF="mailto:poe@cit.dk">poe@cit.dk</A>>.
|
|
Mail::Mailer and Mail::Send by Tim Bunce <<A HREF="mailto:Tim.Bunce@ig.co.uk">Tim.Bunce@ig.co.uk</A>>.
|
|
For other contributors see ChangeLog.
|
|
<A NAME="lbAM"> </A>
|
|
<H2>LICENSE</H2>
|
|
|
|
|
|
|
|
Copyrights 1995-2000 Graham Barr <<A HREF="mailto:gbarr@pobox.com">gbarr@pobox.com</A>> and
|
|
2001-2017 Mark Overmeer <<A HREF="mailto:perl@overmeer.net">perl@overmeer.net</A>>.
|
|
<P>
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
|
under the same terms as Perl itself.
|
|
See <I><A HREF="http://www.perl.com/perl/misc/Artistic.html">http://www.perl.com/perl/misc/Artistic.html</A></I>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="9"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="10"><A HREF="#lbAC">INHERITANCE</A><DD>
|
|
<DT id="11"><A HREF="#lbAD">SYNOPSIS</A><DD>
|
|
<DT id="12"><A HREF="#lbAE">DESCRIPTION</A><DD>
|
|
<DT id="13"><A HREF="#lbAF">METHODS</A><DD>
|
|
<DL>
|
|
<DT id="14"><A HREF="#lbAG">Constructors</A><DD>
|
|
</DL>
|
|
<DT id="15"><A HREF="#lbAH">DETAILS</A><DD>
|
|
<DL>
|
|
<DT id="16"><A HREF="#lbAI"><FONT SIZE="-1">ENVIRONMENT VARIABLES</FONT></A><DD>
|
|
<DT id="17"><A HREF="#lbAJ"><FONT SIZE="-1">BUGS</FONT></A><DD>
|
|
</DL>
|
|
<DT id="18"><A HREF="#lbAK">SEE ALSO</A><DD>
|
|
<DT id="19"><A HREF="#lbAL">AUTHORS</A><DD>
|
|
<DT id="20"><A HREF="#lbAM">LICENSE</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:47 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|