summaryrefslogtreecommitdiff
path: root/lib/Feed/Role/Mail.pm
blob: d50447fbcdfdf22c3e252825ec725871f9f349dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package Feed::Role::Mail; 
use Moose::Role;
use 5.012;
use namespace::autoclean;
 
with 'Feed::HelperRole::Mail';
 
requires 'extract_entries';
 
has mail_address => (
    is => 'ro',
    isa => 'Str',
    required => 1,
);
 
has mail_host => (
    is => 'ro',
    isa => 'Str',
    required => 0,
);
 
sub process_entry {
    my ($self,$entry) = @_;
 
    my ($msg) = $self->entry_to_mime($entry);
    $msg->replace( To => $self->mail_address );
 
    my @mail_args;
    if$self->mail_host ) {
        @mail_args = (smtp => $self->mail_host);
    };
    $msg->send@mail_args );
 
    return;
}
 
1;