1Mail::Mailer(3) User Contributed Perl Documentation Mail::Mailer(3)
2
3
4
6 Mail::Mailer - Simple interface to electronic mailing mechanisms
7
9 Mail::Mailer
10 is a IO::Handle
11
13 use Mail::Mailer;
14 use Mail::Mailer qw(mail); # specifies default mailer
15
16 $mailer = Mail::Mailer->new;
17 $mailer = Mail::Mailer->new($type, @args);
18
19 $mailer->open(\%headers);
20 print $mailer $body;
21 $mailer->close
22 or die "couldn't send whole message: $!\n";
23
25 Sends mail using any of the built-in methods. As TYPE argument to
26 new(), you can specify any of
27
28 "sendmail"
29 Use the "sendmail" program to deliver the mail.
30
31 "smtp"
32 Use the "smtp" protocol via Net::SMTP to deliver the mail. The
33 server to use can be specified in @args with
34
35 $mailer = Mail::Mailer->new('smtp', Server => $server);
36
37 The smtp mailer does not handle "Cc" and "Bcc" lines, neither their
38 "Resent-*" fellows. The "Debug" options enables debugging output
39 from "Net::SMTP".
40
41 You may also use the "Auth => [ $user, $password ]" option for SASL
42 authentication. To make this work, you have to install the
43 Authen::SASL distribution yourself: it is not automatically
44 installed.
45
46 "smtps"
47 Use the smtp over ssl protocol via Net::SMTP::SSL to deliver the
48 mail. Usage is identical to "smtp".
49
50 $mailer = Mail::Mailer->new('smtps', Server => $server);
51
52 "qmail"
53 Use qmail's qmail-inject program to deliver the mail.
54
55 "testfile"
56 Used for debugging, this displays the data to the file named in
57 $Mail::Mailer::testfile::config{outfile} which defaults to a file
58 named "mailer.testfile". No mail is ever sent.
59
60 "Mail::Mailer" will search for executables in the above order. The
61 default mailer will be the first one found.
62
64 Constructors
65 Mail::Mailer->new(TYPE, ARGS)
66
67 The TYPE is one of the back-end sender implementations, as
68 described in the DESCRIPTION chapter of this manual page. The ARGS
69 are passed to that back-end.
70
71 $obj->open(HASH)
72
73 The HASH consists of key and value pairs, the key being the name of
74 the header field (eg, "To"), and the value being the corresponding
75 contents of the header field. The value can either be a scalar
76 (eg, "gnat@frii.com") or a reference to an array of scalars ("eg,
77 ['gnat@frii.com', 'Tim.Bunce@ig.co.uk']").
78
80 ENVIRONMENT VARIABLES
81 PERL_MAILERS
82 Augments/override the build in choice for binary used to send out
83 our mail messages.
84
85 Format:
86
87 "type1:mailbinary1;mailbinary2;...:type2:mailbinaryX;...:..."
88
89 Example: assume you want you use private sendmail binary instead of
90 mailx, one could set "PERL_MAILERS" to:
91
92 "mail:/does/not/exists:sendmail:$HOME/test/bin/sendmail"
93
94 On systems which may include ":" in file names, use "|" as
95 separator between type-groups.
96
97 "mail:c:/does/not/exists|sendmail:$HOME/test/bin/sendmail"
98
99 BUGS
100 Mail::Mailer does not help with folding, and does not protect against
101 various web-script hacker attacks, for instance where a new-line is
102 inserted in the content of the field.
103
105 This module is part of the MailTools distribution,
106 http://perl.overmeer.net/mailtools/.
107
109 The MailTools bundle was developed by Graham Barr. Later, Mark
110 Overmeer took over maintenance without commitment to further
111 development.
112
113 Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by
114 Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce
115 <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.
116
118 Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark
119 Overmeer <perl@overmeer.net>.
120
121 This program is free software; you can redistribute it and/or modify it
122 under the same terms as Perl itself. See
123 http://www.perl.com/perl/misc/Artistic.html
124
125
126
127perl v5.12.2 2010-10-01 Mail::Mailer(3)