1Email::Send::SMTP(3)  User Contributed Perl Documentation Email::Send::SMTP(3)
2
3
4

NAME

6       Email::Send::SMTP - Send Messages using SMTP
7

SYNOPSIS

9         use Email::Send;
10
11         my $mailer = Email::Send->new({mailer => 'SMTP'});
12
13         $mailer->mailer_args([Host => 'smtp.example.com:465', ssl => 1])
14           if $USE_SSL;
15
16         $mailer->send($message);
17

DESCRIPTION

19       This mailer for "Email::Send" uses "Net::SMTP" to send a message with
20       an SMTP server. The first invocation of "send" requires an SMTP server
21       arguments. Subsequent calls will remember the the first setting until
22       it is reset.
23
24       Any arguments passed to "send" will be passed to "Net::SMTP->new()",
25       with some exceptions. "username" and "password", if passed, are used to
26       invoke "Net::SMTP->auth()" for SASL authentication support.  "ssl", if
27       set to true, turns on SSL support by using "Net::SMTP::SSL".
28
29       SMTP can fail for a number of reasons. All return values from this
30       package are true or false. If false, sending has failed. If true, send
31       succeeded. The return values are "Return::Value" objects, however, and
32       contain more information on just what went wrong.
33
34       Here is an example of dealing with failure.
35
36         my $return = send SMTP => $message, 'localhost';
37
38         die "$return" if ! $return;
39
40       The stringified version of the return value will have the text of the
41       error. In a conditional, a failure will evaluate to false.
42
43       Here's an example of dealing with success. It is the case that some
44       email addresses may not succeed but others will. In this case, the
45       return value's "bad" property is set to a list of bad addresses.
46
47         my $return = send SMTP => $message, 'localhost';
48
49         if ( $return ) {
50             my @bad = @{ $return->prop('bad') };
51             warn "Failed to send to: " . join ', ', @bad
52               if @bad;
53         }
54
55       For more information on these return values, see Return::Value.
56
57   ENVELOPE GENERATION
58       The envelope sender and recipients are, by default, generated by
59       looking at the From, To, Cc, and Bcc headers.  This behavior can be
60       modified by replacing the "get_env_sender" and "get_env_recipients"
61       methods, both of which receive the Email::Simple object and their only
62       parameter, and return email addresses.
63

SEE ALSO

65       Email::Send, Net::SMTP, Net::SMTP::SSL, Email::Address, Return::Value,
66       perl.
67

AUTHOR

69       Current maintainer: Ricardo SIGNES, <rjbs@cpan.org>.
70
71       Original author: Casey West, <casey@geeknest.com>.
72
74         Copyright (c) 2004 Casey West.  All rights reserved.
75         This module is free software; you can redistribute it and/or modify it
76         under the same terms as Perl itself.
77
78
79
80perl v5.12.1                      2009-07-12              Email::Send::SMTP(3)
Impressum