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
59       The envelope sender and recipients are, by default, generated by look‐
60       ing at the From, To, Cc, and Bcc headers.  This behavior can be modi‐
61       fied by replacing the "get_env_sender" and "get_env_recipients" meth‐
62       ods, both of which receive the Email::Simple object and their only
63       parameter, and return email addresses.
64

SEE ALSO

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

AUTHOR

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