NAME
Mail::Mailer - Simple interface to electronic mailing mechanisms
SYNOPSIS
use Mail::Mailer;
use Mail::Mailer qw(mail);
$mailer = new Mail::Mailer;
$mailer = new Mail::Mailer $type, @args;
$mailer->open(\%headers);
print $mailer $body;
$mailer->close;
DESCRIPTION
Sends mail using any of the built-in methods. You can alter the behaviour of a method by passing $command to the new method.
mail-
Use the Unix system
mailprogram to deliver the mail.$commandis the path tomail. Mail::Mailer will search formailx,Mailandmail(in this order). sendmail-
Use the
sendmailprogram to deliver the mail.$commandis the path tosendmail. smtp-
Use the
smtpprotocol via Net::SMTP to deliver the mail. The server to use can be specified in@argswith$mailer = new Mail::Mailer 'smtp', Server => $server;The smtp mailer does not handle
CcandBcclines, neither theirResent-*fellows. TheDebugoptions enables debugging output fromNet::SMTP. qmail-
Use qmail's qmail-inject program to deliver the mail.
test-
Used for debugging, this displays the data on STDOUT. No mail is ever sent.
$commandis ignored.
Mail::Mailer will search for executables in the above order. The default mailer will be the first one found.
ARGUMENTS
new can optionally be given a $command and $type. $type is one sendmail, mail, ... given above. The meaning of $command depends on $type.
open is given a reference to a 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']).
TO DO
Assist formatting of fields in ...::rfc822:send_headers to ensure valid in the face of newlines and longlines etc.
Secure all forms of send_headers() against hacker attack and invalid contents. Especially "\n~..." in ...::mail::send_headers.
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_MAILERSto:"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"
SEE ALSO
Mail::Send
AUTHORS
Maintained by Mark Overmeer <mailtools@overmeer.net>
Original code written by Tim Bunce <Tim.Bunce@ig.co.uk>, with a kick start from Graham Barr <gbarr@pobox.com>. With contributions by Gerard Hickey <hickey@ctron.com> Small fix and documentation by Nathan Torkington <gnat@frii.com>.