1Mail::Mailer(3) User Contributed Perl Documentation Mail::Mailer(3)
2
3
4
6 Mail::Mailer - Simple interface to electronic mailing mechanisms
7
9 use Mail::Mailer;
10 use Mail::Mailer qw(mail); # specifies default mailer
11
12 $mailer = new Mail::Mailer;
13
14 $mailer = new Mail::Mailer $type, @args;
15
16 $mailer->open(\%headers);
17
18 print $mailer $body;
19
20 $mailer->close;
21
23 Sends mail using any of the built-in methods. As $type you can specify
24 any of:
25
26 "sendmail" Use the "sendmail" program to deliver the mail.
27 "smtp"
28 Use the "smtp" protocol via Net::SMTP to deliver the mail. The
29 server to use can be specified in @args with
30
31 $mailer = new Mail::Mailer 'smtp', Server => $server;
32
33 The smtp mailer does not handle "Cc" and "Bcc" lines, neither their
34 "Resent-*" fellows. The "Debug" options enables debugging output
35 from "Net::SMTP".
36
37 You may also use the "Auth => [ $user, $password ]" option for SASL
38 authentication (requires Authen::SASL and MIME::Base64).
39
40 "qmail"
41 Use qmail's qmail-inject program to deliver the mail.
42
43 "testfile"
44 Used for debugging, this displays the data to the file named in
45 $Mail::Mailer::testfile::config{outfile} which defaults to a file
46 named "mailer.testfile". No mail is ever sent.
47
48 "Mail::Mailer" will search for executables in the above order. The
49 default mailer will be the first one found.
50
51 ARGUMENTS
52
53 "new" can optionally be given a $type, which is one "sendmail", "mail",
54 ... given above.
55
56 "open" is given a reference to a hash. The hash consists of key and
57 value pairs, the key being the name of the header field (eg, "To"), and
58 the value being the corresponding contents of the header field. The
59 value can either be a scalar (eg, "gnat@frii.com") or a reference to an
60 array of scalars ("eg, ['gnat@frii.com', 'Tim.Bunce@ig.co.uk']").
61
63 Assist formatting of fields in ...::rfc822:send_headers to ensure valid
64 in the face of newlines and longlines etc.
65
66 Secure all forms of send_headers() against hacker attack and invalid
67 contents. Especially "\n~..." in ...::mail::send_headers.
68
70 PERL_MAILERS
71 Augments/override the build in choice for binary used to send out
72 our mail messages.
73
74 Format:
75
76 "type1:mailbinary1;mailbinary2;...:type2:mailbinaryX;...:..."
77
78 Example: assume you want you use private sendmail binary instead of
79 mailx, one could set "PERL_MAILERS" to:
80
81 "mail:/does/not/exists:sendmail:$HOME/test/bin/sendmail"
82
83 On systems which may include ":" in file names, use "⎪" as separa‐
84 tor between type-groups.
85
86 "mail:c:/does/not/exists⎪sendmail:$HOME/test/bin/sendmail"
87
89 Mail::Send
90
92 Maintained by Mark Overmeer <mailtools@overmeer.net>
93
94 Original code written by Tim Bunce <Tim.Bunce@ig.co.uk>, with a kick
95 start from Graham Barr <gbarr@pobox.com>. With contributions by Gerard
96 Hickey <hickey@ctron.com> Small fix and documentation by Nathan Tork‐
97 ington <gnat@frii.com>.
98
99
100
101perl v5.8.8 2007-05-11 Mail::Mailer(3)