1Email::Sender(3) User Contributed Perl Documentation Email::Sender(3)
2
3
4
6 Email::Sender - a library for sending email
7
9 version 0.101760
10
12 my $message = Email::MIME->create( ... );
13 # produce an Email::Abstract compatible message object,
14 # e.g. produced by Email::Simple, Email::MIME, Email::Stuff
15
16 use Email::Sender::Simple qw(sendmail);
17 use Email::Sender::Transport::SMTP qw();
18 use Try::Tiny;
19
20 try {
21 sendmail(
22 $message,
23 {
24 from => $SMTP_ENVELOPE_FROM_ADDRESS,
25 transport => Email::Sender::Transport::SMTP->new({
26 host => $SMTP_HOSTNAME,
27 port => $SMTP_PORT,
28 })
29 }
30 );
31 } catch {
32 warn "sending failed: $_";
33 };
34
36 Email::Sender replaces the old and sometimes problematic Email::Send
37 library, which did a decent job at handling very simple email sending
38 tasks, but was not suitable for serious use, for a variety of reasons.
39
40 Most users will be able to use Email::Sender::Simple to send mail.
41 Users with more specific needs should look at the available
42 Email::Sender::Transport classes.
43
44 Documentation may be found in Email::Sender::Manual, and new users
45 should start with Email::Sender::Manual::QuickStart.
46
48 Email::Sender itelf is a Moose role. Any class that implements
49 Email::Sender is required to provide a method called "send". This
50 method should accept any input that can be understood by
51 Email::Abstract, followed by a hashref containing "to" and "from"
52 arguments to be used as the envelope. The method should return an
53 Email::Sender::Success object on success or throw an
54 Email::Sender::Failure on failure.
55
57 Ricardo Signes <rjbs@cpan.org>
58
60 This software is copyright (c) 2010 by Ricardo Signes.
61
62 This is free software; you can redistribute it and/or modify it under
63 the same terms as the Perl 5 programming language system itself.
64
65
66
67perl v5.12.1 2010-06-25 Email::Sender(3)