diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-06-02 21:57:57 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-06-02 21:57:57 +0100 |
commit | 9ac1bac73d0b12f313d6863832b4b5547fded756 (patch) | |
tree | 0bdfc2ee72c86aa96df450130584ba69f3a90d8b /bin/send-reports | |
parent | 2f98dc698dac2e5a4b8f2027d5c0336d444acd73 (diff) |
Move most of questionnaire cron to ResultSet so it can be called and tested from test.
Diffstat (limited to 'bin/send-reports')
-rwxr-xr-x | bin/send-reports | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/bin/send-reports b/bin/send-reports index cec1dee42..feee74c76 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -24,11 +24,8 @@ use FixMyStreet::App; use EastHantsWSDL; use Utils; use mySociety::Config; -use mySociety::Email; use mySociety::EmailUtil; -use mySociety::Locale; use mySociety::MaPit; -use mySociety::Random qw(random_bytes); use mySociety::Web qw(ent); # Set up site, language etc. @@ -225,20 +222,17 @@ while (my $row = $unsent->next) { my $result = -1; if ($send_email) { - - my $params = { - _template_ => $template, - _parameters_ => \%h, - To => \@to, - From => [ $row->user->email, $row->name ], - 'Message-ID' => sprintf('<report-%s-%s@mysociety.org>', time(), unpack('h*', random_bytes(5, 1))), - }; - my $email = mySociety::Locale::in_gb_locale { mySociety::Email::construct_email($params) }; - if (!$nomail) { - $result *= mySociety::EmailUtil::send_email($email, mySociety::Config::get('CONTACT_EMAIL'), @recips); - } else { - print $email; - } + $result *= FixMyStreet::App->send_email_cron( + { + _template_ => $template, + _parameters_ => \%h, + To => \@to, + From => [ $row->user->email, $row->name ], + }, + mySociety::Config::get('CONTACT_EMAIL'), + \@recips, + $nomail + ); } if ($send_web eq 'easthants') { |