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 (requires Authen::SASL and MIME::Base64).
43
44 "qmail"
45 Use qmail's qmail-inject program to deliver the mail.
46
47 "testfile"
48 Used for debugging, this displays the data to the file named in
49 $Mail::Mailer::testfile::config{outfile} which defaults to a file
50 named "mailer.testfile". No mail is ever sent.
51
52 "Mail::Mailer" will search for executables in the above order. The
53 default mailer will be the first one found.
54
56 Constructors
57 Mail::Mailer->new(TYPE, ARGS)
58
59 The TYPE is one of the back-end sender implementations, as
60 described in the DESCRIPTION chapter of this manual page. The ARGS
61 are passed to that back-end.
62
63 $obj->open(HASH)
64
65 The HASH consists of key and value pairs, the key being the name of
66 the header field (eg, "To"), and the value being the corresponding
67 contents of the header field. The value can either be a scalar
68 (eg, "gnat@frii.com") or a reference to an array of scalars ("eg,
69 ['gnat@frii.com', 'Tim.Bunce@ig.co.uk']").
70
72 ENVIRONMENT VARIABLES
73 PERL_MAILERS
74 Augments/override the build in choice for binary used to send out
75 our mail messages.
76
77 Format:
78
79 "type1:mailbinary1;mailbinary2;...:type2:mailbinaryX;...:..."
80
81 Example: assume you want you use private sendmail binary instead of
82 mailx, one could set "PERL_MAILERS" to:
83
84 "mail:/does/not/exists:sendmail:$HOME/test/bin/sendmail"
85
86 On systems which may include ":" in file names, use "|" as
87 separator between type-groups.
88
89 "mail:c:/does/not/exists|sendmail:$HOME/test/bin/sendmail"
90
91 BUGS
92 Mail::Mailer does not help with folding, and does not protect against
93 various web-script hacker attacks, for instance where a new-line is
94 inserted in the content of the field.
95
97 This module is part of the MailTools distribution,
98 http://perl.overmeer.net/mailtools/.
99
101 The MailTools bundle was developed by Graham Barr. Later, Mark
102 Overmeer took over maintenance without commitment to further
103 development.
104
105 Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by
106 Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce
107 <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.
108
110 Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark
111 Overmeer <perl@overmeer.net>.
112
113 This program is free software; you can redistribute it and/or modify it
114 under the same terms as Perl itself. See
115 http://www.perl.com/perl/misc/Artistic.html
116
117
118
119perl v5.10.1 2008-07-29 Mail::Mailer(3)