line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Email::MIME::Kit::Bulk::Target; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
10
|
|
|
10
|
|
242
|
$Email::MIME::Kit::Bulk::Target::AUTHORITY = 'cpan:YANICK'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: Destination for an Email::MIME::Kit::Bulk email |
6
|
|
|
|
|
|
|
$Email::MIME::Kit::Bulk::Target::VERSION = '0.0.1'; |
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
31
|
use strict; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
297
|
|
9
|
10
|
|
|
10
|
|
48
|
use warnings; |
|
10
|
|
|
|
|
10
|
|
|
10
|
|
|
|
|
336
|
|
10
|
|
|
|
|
|
|
|
11
|
10
|
|
|
10
|
|
48
|
use Moose; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
69
|
|
12
|
10
|
|
|
10
|
|
45312
|
use namespace::autoclean; |
|
10
|
|
|
|
|
10
|
|
|
10
|
|
|
|
|
91
|
|
13
|
|
|
|
|
|
|
|
14
|
10
|
|
|
10
|
|
610
|
use MooseX::Types::Email; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
142
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has to => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
isa => 'MooseX::Types::Email::EmailAddress', |
20
|
|
|
|
|
|
|
required => 1, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has cc => ( |
25
|
|
|
|
|
|
|
traits => ['Array'], |
26
|
|
|
|
|
|
|
isa => 'ArrayRef[MooseX::Types::Email::EmailAddress]', |
27
|
|
|
|
|
|
|
default => sub { [] }, |
28
|
|
|
|
|
|
|
handles => { |
29
|
|
|
|
|
|
|
cc => 'elements', |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has bcc => ( |
35
|
|
|
|
|
|
|
traits => ['Array'], |
36
|
|
|
|
|
|
|
isa => 'ArrayRef[MooseX::Types::Email::EmailAddress]', |
37
|
|
|
|
|
|
|
default => sub { [] }, |
38
|
|
|
|
|
|
|
handles => { |
39
|
|
|
|
|
|
|
bcc => 'elements', |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has from => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
isa => 'MooseX::Types::Email::EmailAddress', |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has language => ( |
51
|
|
|
|
|
|
|
is => 'ro', |
52
|
|
|
|
|
|
|
isa => 'Str', |
53
|
|
|
|
|
|
|
predicate => 'has_language', |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has template_params => ( |
58
|
|
|
|
|
|
|
is => 'ro', |
59
|
|
|
|
|
|
|
isa => 'HashRef', |
60
|
|
|
|
|
|
|
default => sub { {} }, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
has extra_attachments => ( |
65
|
|
|
|
|
|
|
traits => ['Array'], |
66
|
|
|
|
|
|
|
isa => 'ArrayRef[Str|ArrayRef[Str]]', |
67
|
|
|
|
|
|
|
default => sub { [] }, |
68
|
|
|
|
|
|
|
handles => { |
69
|
|
|
|
|
|
|
extra_attachments => 'elements', |
70
|
|
|
|
|
|
|
}, |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub recipients { |
75
|
2
|
|
|
2
|
1
|
2
|
my $self = shift; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# TODO remove dupes? |
78
|
|
|
|
|
|
|
return ( |
79
|
2
|
|
|
|
|
51
|
$self->to, |
80
|
|
|
|
|
|
|
$self->cc, |
81
|
|
|
|
|
|
|
$self->bcc, |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=pod |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=encoding UTF-8 |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 NAME |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Email::MIME::Kit::Bulk::Target - Destination for an Email::MIME::Kit::Bulk email |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 VERSION |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
version 0.0.1 |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 SYNOPSIS |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
use Email::MIME::Kit::Bulk::Target; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
my $target = Email::MIME::Kit::Bulk::Target->new( |
108
|
|
|
|
|
|
|
to => 'someone@somewhere.com', |
109
|
|
|
|
|
|
|
cc => [ 'someone_else@somewhere.com' ], |
110
|
|
|
|
|
|
|
bcc => [ 'sneaky@somewhere.com' ], |
111
|
|
|
|
|
|
|
from => 'me@somewhere.com', |
112
|
|
|
|
|
|
|
language => 'en', |
113
|
|
|
|
|
|
|
template_params => { |
114
|
|
|
|
|
|
|
greetings => 'Hi', |
115
|
|
|
|
|
|
|
}, |
116
|
|
|
|
|
|
|
extra_attachments => [ 'foo.pdf' ] |
117
|
|
|
|
|
|
|
); |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Email::MIME::Kit::Bulk->new( |
120
|
|
|
|
|
|
|
kit => '/path/to/mime/kit', |
121
|
|
|
|
|
|
|
processes => 5, |
122
|
|
|
|
|
|
|
targets => [ $target ], |
123
|
|
|
|
|
|
|
)->send; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 DESCRIPTION |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
A L<Email::MIME::Kit::Bulk> object will produce one email for every |
128
|
|
|
|
|
|
|
C<Email::MIME::Kit::Bulk::Target> object it is given. Each target object |
129
|
|
|
|
|
|
|
defines the recipients of the email, and can also be take |
130
|
|
|
|
|
|
|
attachments, specific I<From> address and custom parameters for the MIME kit |
131
|
|
|
|
|
|
|
template. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 METHODS |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 new( %args ) |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Constructor. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head3 Arguments |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=over |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item to => $email_address |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
C<To> Email address. Can be a string or a L<MooseX::Types::Email::EmailAddress> object. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Required. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item cc => \@email_addresses |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
C<Cc> Email addressses. Array ref of L<MooseX::Types::Email::EmailAddress> objects. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item bcc => \@email_addresses |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
C<Bcc> Email addressses. Array ref of L<MooseX::Types::Email::EmailAddress> objects. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item from => $email_address |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Address to use for the C<From> originator. |
160
|
|
|
|
|
|
|
Must be a L<MooseX::Types::Email::EmailAddress> object. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item language => $lang |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Language to use for this target. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item template_params => \%params |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Parameters to be passed to the L<Email::MIME::Kit> template. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item extra_attachments => \@attachments |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Attachments to add to the email for this target. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=back |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 to() |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Returns the L<MooseX::Types::Email::EmailAddress> object |
179
|
|
|
|
|
|
|
for the C<To> recipient. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 cc() |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
my @cc = $target->cc; |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Returns the list of L<MooseX::Types::Email::EmailAddress> objects |
186
|
|
|
|
|
|
|
for the C<Cc> recipients. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 bcc() |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
my @bcc = $target->bcc; |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Returns the list of L<MooseX::Types::Email::EmailAddress> objects |
193
|
|
|
|
|
|
|
for the C<Bcc> recipients. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head2 from() |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
my $from = $target->from; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Returns the L<MooseX::Types::Email::EmailAddress> object |
200
|
|
|
|
|
|
|
for the C<From> originator. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head2 language() |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
my $lang = $target->language; |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Returns the language set for the target. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 has_language() |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Returns true if a language was set for the target. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head2 template_params() |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Returns the hash ref of the parameters that will be passed to the |
215
|
|
|
|
|
|
|
L<Email::MIME::Kit> template. |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head2 extra_attachments() |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Returns the list of extra attachments that will be added |
220
|
|
|
|
|
|
|
to the email for this target. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 recipients |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Returns all the recipients (I<To>, I<Cc> and I<Bcc> combined) of the email. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head1 AUTHORS |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=over 4 |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=item * |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Jesse Luehrs <doy@cpan.org> |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=item * |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Yanick Champoux <yanick.champoux@iinteractive.com> |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=back |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Infinity Interactive <contact@iinteractive.com>. |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
245
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=cut |