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