.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mail::Mailer 3pm" .TH Mail::Mailer 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Mail::Mailer \- send simple emails .SH INHERITANCE .IX Header "INHERITANCE" .Vb 2 \& Mail::Mailer \& is an IO::Handle .Ve .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Mail::Mailer; \& use Mail::Mailer qw(mail); # specifies default mailer \& \& $mailer = Mail::Mailer\->new; \& $mailer = Mail::Mailer\->new($type, @args); \& \& $mailer\->open(\e%headers); \& print $mailer $body; \& $mailer\->close \& or die "couldn\*(Aqt send whole message: $!\en"; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Sends mail using any of the built-in methods. As TYPE argument to \fBnew()\fR, you can specify any of .ie n .IP """sendmail""" 4 .el .IP \f(CWsendmail\fR 4 .IX Item "sendmail" Use the \f(CW\*(C`sendmail\*(C'\fR program to deliver the mail. .ie n .IP """smtp""" 4 .el .IP \f(CWsmtp\fR 4 .IX Item "smtp" Use the \f(CW\*(C`smtp\*(C'\fR protocol via Net::SMTP to deliver the mail. The server to use can be specified in \f(CW@args\fR with .Sp .Vb 1 \& $mailer = Mail::Mailer\->new(\*(Aqsmtp\*(Aq, Server => $server); .Ve .Sp The smtp mailer does not handle \f(CW\*(C`Cc\*(C'\fR and \f(CW\*(C`Bcc\*(C'\fR lines, neither their \&\f(CW\*(C`Resent\-*\*(C'\fR fellows. The \f(CW\*(C`Debug\*(C'\fR options enables debugging output from \f(CW\*(C`Net::SMTP\*(C'\fR. .Sp [added 2.21] You may also use the \f(CW\*(C`StartTLS => 1\*(C'\fR options to upgrade the connection with STARTTLS. You need \f(CW\*(C`libnet\*(C'\fR version 1.28 (2014) for this to work. .Sp You may also use the \f(CW\*(C`Auth => [ $user, $password ]\*(C'\fR option for SASL authentication. To make this work, you have to install the Authen::SASL distribution yourself: it is not automatically installed. .ie n .IP """smtps""" 4 .el .IP \f(CWsmtps\fR 4 .IX Item "smtps" This option is \fBdeprecated\fR when you have \f(CW\*(C`libnet\*(C'\fR 1.28 (2014) and above. .Sp Use the smtp over ssl protocol via Net::SMTP::SSL to deliver the mail. Usage is identical to \f(CW\*(C`smtp\*(C'\fR. You have to install Authen::SASL as well. .Sp .Vb 1 \& $mailer = Mail::Mailer\->new(\*(Aqsmtps\*(Aq, Server => $server); .Ve .ie n .IP """qmail""" 4 .el .IP \f(CWqmail\fR 4 .IX Item "qmail" Use qmail's qmail-inject program to deliver the mail. .ie n .IP """testfile""" 4 .el .IP \f(CWtestfile\fR 4 .IX Item "testfile" Used for debugging, this displays the data to the file named in \&\f(CW$Mail::Mailer::testfile::config{outfile}\fR which defaults to a file named \f(CW\*(C`mailer.testfile\*(C'\fR. No mail is ever sent. .PP \&\f(CW\*(C`Mail::Mailer\*(C'\fR will search for executables in the above order. The default mailer will be the first one found. .SH METHODS .IX Header "METHODS" .SS Constructors .IX Subsection "Constructors" .ie n .IP "Mail::Mailer\->\fBnew\fR($type, %options)" 4 .el .IP "Mail::Mailer\->\fBnew\fR($type, \f(CW%options\fR)" 4 .IX Item "Mail::Mailer->new($type, %options)" The \f(CW$type\fR is one of the back-end sender implementations, as described in the DESCRIPTION chapter of this manual page. The \f(CW%options\fR are passed to that back-end. .ie n .IP $obj\->\fBopen\fR(HASH) 4 .el .IP \f(CW$obj\fR\->\fBopen\fR(HASH) 4 .IX Item "$obj->open(HASH)" The HASH consists of key and value pairs, the key being the name of the header field (eg, \f(CW\*(C`To\*(C'\fR), and the value being the corresponding contents of the header field. The value can either be a scalar (eg, \f(CW\*(C`gnat@frii.com\*(C'\fR) or a reference to an array of scalars (\f(CW\*(C`eg, [\*(Aqgnat@frii.com\*(Aq, \*(AqTim.Bunce@ig.co.uk\*(Aq]\*(C'\fR). .SH DETAILS .IX Header "DETAILS" .SS "ENVIRONMENT VARIABLES" .IX Subsection "ENVIRONMENT VARIABLES" .IP PERL_MAILERS 4 .IX Item "PERL_MAILERS" Augments/override the build in choice for binary used to send out our mail messages. .Sp Format: .Sp .Vb 1 \& "type1:mailbinary1;mailbinary2;...:type2:mailbinaryX;...:..." .Ve .Sp Example: assume you want you use private sendmail binary instead of mailx, one could set \f(CW\*(C`PERL_MAILERS\*(C'\fR to: .Sp .Vb 1 \& "mail:/does/not/exists:sendmail:$HOME/test/bin/sendmail" .Ve .Sp On systems which may include \f(CW\*(C`:\*(C'\fR in file names, use \f(CW\*(C`|\*(C'\fR as separator between type-groups. .Sp .Vb 1 \& "mail:c:/does/not/exists|sendmail:$HOME/test/bin/sendmail" .Ve .SS BUGS .IX Subsection "BUGS" 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. .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of the MailTools distribution, \&\fIhttp://perl.overmeer.net/mailtools/\fR. .SH AUTHORS .IX Header "AUTHORS" The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance without commitment to further development. .PP Mail::Cap by Gisle Aas . Mail::Field::AddrList by Peter Orbaek . Mail::Mailer and Mail::Send by Tim Bunce . For other contributors see ChangeLog. .SH LICENSE .IX Header "LICENSE" Copyrights 1995\-2000 Graham Barr and 2001\-2017 Mark Overmeer . .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See \fIhttp://www.perl.com/perl/misc/Artistic.html\fR