| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
8
|
|
|
8
|
|
144434
|
use strict; |
|
|
8
|
|
|
|
|
36
|
|
|
|
8
|
|
|
|
|
261
|
|
|
2
|
8
|
|
|
8
|
|
43
|
use warnings; |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
353
|
|
|
3
|
|
|
|
|
|
|
package Email::Sender::Util 2.500; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: random stuff that makes Email::Sender go |
|
5
|
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
2855
|
use Email::Address; |
|
|
8
|
|
|
|
|
143750
|
|
|
|
8
|
|
|
|
|
352
|
|
|
7
|
8
|
|
|
8
|
|
933
|
use Email::Sender::Failure; |
|
|
8
|
|
|
|
|
18
|
|
|
|
8
|
|
|
|
|
249
|
|
|
8
|
8
|
|
|
8
|
|
1430
|
use Email::Sender::Failure::Permanent; |
|
|
8
|
|
|
|
|
30
|
|
|
|
8
|
|
|
|
|
223
|
|
|
9
|
8
|
|
|
8
|
|
1358
|
use Email::Sender::Failure::Temporary; |
|
|
8
|
|
|
|
|
19
|
|
|
|
8
|
|
|
|
|
263
|
|
|
10
|
8
|
|
|
8
|
|
49
|
use List::Util 1.45 (); |
|
|
8
|
|
|
|
|
202
|
|
|
|
8
|
|
|
|
|
198
|
|
|
11
|
8
|
|
|
8
|
|
60
|
use Module::Runtime qw(require_module); |
|
|
8
|
|
|
|
|
16
|
|
|
|
8
|
|
|
|
|
80
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# This code will be used by Email::Sender::Simple. -- rjbs, 2008-12-04 |
|
14
|
|
|
|
|
|
|
sub _recipients_from_email { |
|
15
|
1
|
|
|
1
|
|
4
|
my ($self, $email) = @_; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my @to = List::Util::uniq( |
|
18
|
7
|
|
|
|
|
120
|
map { $_->address } |
|
19
|
4
|
|
|
|
|
1045
|
map { Email::Address->parse($_) } |
|
20
|
1
|
|
|
|
|
4
|
map { $email->get_header($_) } |
|
|
3
|
|
|
|
|
131
|
|
|
21
|
|
|
|
|
|
|
qw(to cc bcc)); |
|
22
|
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
22
|
return \@to; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _sender_from_email { |
|
27
|
1
|
|
|
1
|
|
331
|
my ($self, $email) = @_; |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
1503
|
my ($sender) = map { $_->address } |
|
30
|
1
|
|
|
|
|
6
|
map { Email::Address->parse($_) } |
|
|
1
|
|
|
|
|
107
|
|
|
31
|
|
|
|
|
|
|
scalar $email->get_header('from'); |
|
32
|
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
13
|
return $sender; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# It's probably reasonable to make this code publicker at some point, but for |
|
37
|
|
|
|
|
|
|
# now I don't want to deal with making a sane set of args. -- rjbs, 2008-12-09 |
|
38
|
|
|
|
|
|
|
sub _failure { |
|
39
|
7
|
|
|
7
|
|
9591
|
my ($self, $error, $smtp, @rest) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
7
|
|
|
|
|
62
|
my ($code, $message); |
|
42
|
7
|
100
|
|
|
|
17
|
if ($smtp) { |
|
43
|
6
|
|
|
|
|
18
|
$code = $smtp->code; |
|
44
|
6
|
|
|
|
|
14
|
$message = $smtp->message; |
|
45
|
6
|
50
|
|
|
|
21
|
$message = ! defined $message ? "(no SMTP error message)" |
|
|
|
50
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
: ! length $message ? "(empty SMTP error message)" |
|
47
|
|
|
|
|
|
|
: $message; |
|
48
|
|
|
|
|
|
|
|
|
49
|
6
|
100
|
66
|
|
|
27
|
$message = defined $error && length $error |
|
50
|
|
|
|
|
|
|
? "$error: $message" |
|
51
|
|
|
|
|
|
|
: $message; |
|
52
|
|
|
|
|
|
|
} else { |
|
53
|
1
|
|
|
|
|
5
|
$message = $error; |
|
54
|
1
|
50
|
|
|
|
5
|
$message = "(no error given)" unless defined $message; |
|
55
|
1
|
50
|
|
|
|
3
|
$message = "(empty error string)" unless length $message; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
7
|
100
|
|
|
|
34
|
my $error_class = ! $code ? 'Email::Sender::Failure' |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
: $code =~ /^4/ ? 'Email::Sender::Failure::Temporary' |
|
60
|
|
|
|
|
|
|
: $code =~ /^5/ ? 'Email::Sender::Failure::Permanent' |
|
61
|
|
|
|
|
|
|
: 'Email::Sender::Failure'; |
|
62
|
|
|
|
|
|
|
|
|
63
|
7
|
|
|
|
|
156
|
$error_class->new({ |
|
64
|
|
|
|
|
|
|
message => $message, |
|
65
|
|
|
|
|
|
|
code => $code, |
|
66
|
|
|
|
|
|
|
@rest, |
|
67
|
|
|
|
|
|
|
}); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#pod =method easy_transport |
|
71
|
|
|
|
|
|
|
#pod |
|
72
|
|
|
|
|
|
|
#pod my $transport = Email::Sender::Util->easy_transport($class => \%arg); |
|
73
|
|
|
|
|
|
|
#pod |
|
74
|
|
|
|
|
|
|
#pod This takes the name of a transport class and a set of args to new. It returns |
|
75
|
|
|
|
|
|
|
#pod an Email::Sender::Transport object of that class. |
|
76
|
|
|
|
|
|
|
#pod |
|
77
|
|
|
|
|
|
|
#pod C<$class> is rewritten to C unless it starts |
|
78
|
|
|
|
|
|
|
#pod with an equals sign (C<=>) or contains a colon. The equals sign, if present, |
|
79
|
|
|
|
|
|
|
#pod will be removed. |
|
80
|
|
|
|
|
|
|
#pod |
|
81
|
|
|
|
|
|
|
#pod =cut |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub _rewrite_class { |
|
84
|
7
|
|
|
7
|
|
2009
|
my $transport_class = $_[1]; |
|
85
|
7
|
100
|
100
|
|
|
54
|
if ($transport_class !~ s/^=// and $transport_class !~ m{:}) { |
|
86
|
3
|
|
|
|
|
10
|
$transport_class = "Email::Sender::Transport::$transport_class"; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
7
|
|
|
|
|
27
|
return $transport_class; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub easy_transport { |
|
93
|
3
|
|
|
3
|
1
|
11
|
my ($self, $transport_class, $arg) = @_; |
|
94
|
|
|
|
|
|
|
|
|
95
|
3
|
|
|
|
|
10
|
$transport_class = $self->_rewrite_class($transport_class); |
|
96
|
|
|
|
|
|
|
|
|
97
|
3
|
|
|
|
|
17
|
require_module($transport_class); |
|
98
|
3
|
|
|
|
|
2448
|
return $transport_class->new($arg); |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__ |