-
Notifications
You must be signed in to change notification settings - Fork 2
/
send-protest
executable file
·47 lines (42 loc) · 1.09 KB
/
send-protest
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
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env perl
use 5.14.1;
use Dancer qw/:syntax/;
use Dancer::Plugin::Email;
use FindBin;
use Cwd qw/realpath/;
use lib "$FindBin::Bin/../lib";
use Biopay::EmailReceipt qw/parse_email/;
use Biopay::Member;
use Getopt::Long;
BEGIN {
Dancer::Config::setting('appdir',realpath("$FindBin::Bin/.."));
Dancer::Config::setting('views',realpath("$FindBin::Bin/../views"));
Dancer::Config::load();
}
my %opts;
GetOptions( \%opts,
'cc',
);
my $member_id = shift || die "USAGE: $0 <member_id>";;
my $member = Biopay::Member->By_id($member_id);
my @to = qw/FIN.Minister@gov.bc.ca premier@gov.bc.ca/;
my @member_emails = parse_email($member->email);
if ($opts{cc}) {
push @to, @member_emails;
}
my $html = template "email/protest", {
member => $member,
last_receipt => $member->last_receipt,
}, { layout => 'email' };
for my $recip (@to) {
warn "Sending mail to $recip";
email {
from => $member_emails[0],
reply_to => $member_emails[0],
to => $recip,
subject => "Taxation of Biofuels",
type => 'html',
message => $html,
};
}
exit;