| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Email::Sender 2.500; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: a library for sending email |
|
3
|
|
|
|
|
|
|
|
|
4
|
12
|
|
|
12
|
|
156534
|
use Moo::Role; |
|
|
12
|
|
|
|
|
55610
|
|
|
|
12
|
|
|
|
|
95
|
|
|
5
|
|
|
|
|
|
|
requires 'send'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
#pod |
|
9
|
|
|
|
|
|
|
#pod my $message = Email::MIME->create( ... ); |
|
10
|
|
|
|
|
|
|
#pod # produce an Email::Abstract compatible message object, |
|
11
|
|
|
|
|
|
|
#pod # e.g. produced by Email::Simple, Email::MIME, Email::Stuff |
|
12
|
|
|
|
|
|
|
#pod |
|
13
|
|
|
|
|
|
|
#pod use Email::Sender::Simple qw(sendmail); |
|
14
|
|
|
|
|
|
|
#pod use Email::Sender::Transport::SMTP qw(); |
|
15
|
|
|
|
|
|
|
#pod use Try::Tiny; |
|
16
|
|
|
|
|
|
|
#pod |
|
17
|
|
|
|
|
|
|
#pod try { |
|
18
|
|
|
|
|
|
|
#pod sendmail( |
|
19
|
|
|
|
|
|
|
#pod $message, |
|
20
|
|
|
|
|
|
|
#pod { |
|
21
|
|
|
|
|
|
|
#pod from => $SMTP_ENVELOPE_FROM_ADDRESS, |
|
22
|
|
|
|
|
|
|
#pod transport => Email::Sender::Transport::SMTP->new({ |
|
23
|
|
|
|
|
|
|
#pod host => $SMTP_HOSTNAME, |
|
24
|
|
|
|
|
|
|
#pod port => $SMTP_PORT, |
|
25
|
|
|
|
|
|
|
#pod }) |
|
26
|
|
|
|
|
|
|
#pod } |
|
27
|
|
|
|
|
|
|
#pod ); |
|
28
|
|
|
|
|
|
|
#pod } catch { |
|
29
|
|
|
|
|
|
|
#pod warn "sending failed: $_"; |
|
30
|
|
|
|
|
|
|
#pod }; |
|
31
|
|
|
|
|
|
|
#pod |
|
32
|
|
|
|
|
|
|
#pod =head1 OVERVIEW |
|
33
|
|
|
|
|
|
|
#pod |
|
34
|
|
|
|
|
|
|
#pod Email::Sender replaces the old and sometimes problematic Email::Send library, |
|
35
|
|
|
|
|
|
|
#pod which did a decent job at handling very simple email sending tasks, but was not |
|
36
|
|
|
|
|
|
|
#pod suitable for serious use, for a variety of reasons. |
|
37
|
|
|
|
|
|
|
#pod |
|
38
|
|
|
|
|
|
|
#pod Most users will be able to use L to send mail. Users |
|
39
|
|
|
|
|
|
|
#pod with more specific needs should look at the available Email::Sender::Transport |
|
40
|
|
|
|
|
|
|
#pod classes. |
|
41
|
|
|
|
|
|
|
#pod |
|
42
|
|
|
|
|
|
|
#pod Documentation may be found in L, and new users should |
|
43
|
|
|
|
|
|
|
#pod start with L. |
|
44
|
|
|
|
|
|
|
#pod |
|
45
|
|
|
|
|
|
|
#pod =head1 IMPLEMENTING |
|
46
|
|
|
|
|
|
|
#pod |
|
47
|
|
|
|
|
|
|
#pod Email::Sender itself is a Moo role. Any class that implements Email::Sender |
|
48
|
|
|
|
|
|
|
#pod is required to provide a method called C. This method should accept any |
|
49
|
|
|
|
|
|
|
#pod input that can be understood by L, followed by a hashref |
|
50
|
|
|
|
|
|
|
#pod containing C and C arguments to be used as the envelope. The method |
|
51
|
|
|
|
|
|
|
#pod should return an L object on success or throw an |
|
52
|
|
|
|
|
|
|
#pod L on failure. |
|
53
|
|
|
|
|
|
|
#pod |
|
54
|
|
|
|
|
|
|
#pod =cut |
|
55
|
|
|
|
|
|
|
|
|
56
|
12
|
|
|
12
|
|
4953
|
no Moo::Role; |
|
|
12
|
|
|
|
|
30
|
|
|
|
12
|
|
|
|
|
99
|
|
|
57
|
|
|
|
|
|
|
1; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |