diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-01-09 22:55:08 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-01-13 16:28:50 +0000 |
commit | 676181084d88b0ec94d42521162b4571cb0c0552 (patch) | |
tree | 744979e676295aa7daf2de3aa03818b1f6419fb6 /perllib/FixMyStreet/DB | |
parent | 4ae8d597a80d91084dcdcd999d480f41a57c70d1 (diff) |
Use same handling for cron and non-cron email.
This means that e.g. SMTP authentication is used when set up by all
emails, not just non-cron ones. Fixes #988.
Diffstat (limited to 'perllib/FixMyStreet/DB')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/AlertType.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm | 4 |
3 files changed, 4 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm index 5bed95811..b704fa7dd 100644 --- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm +++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm @@ -5,7 +5,6 @@ use strict; use warnings; use mySociety::DBHandle qw(dbh); -use mySociety::EmailUtil; use mySociety::Gaze; use mySociety::Locale; use mySociety::MaPit; @@ -262,13 +261,12 @@ sub _send_aggregated_alert_email(%) { To => $data{alert_email}, }, $sender, - [ $data{alert_email} ], 0, $cobrand, $data{lang} ); - if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) { + unless ($result) { $token->insert(); } else { print "Failed to send alert $data{alert_id}!"; diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index d3c016be6..a84a309ee 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -8,7 +8,6 @@ use CronFns; use Utils; use mySociety::Config; -use mySociety::EmailUtil; use mySociety::MaPit; use FixMyStreet::App; @@ -438,7 +437,7 @@ sub send_reports { } } - if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) { + unless ($result) { $row->update( { whensent => \'ms_current_timestamp()', lastupdate => \'ms_current_timestamp()', @@ -501,7 +500,7 @@ sub _send_report_sent_email { my $template = FixMyStreet->get_email_template($row->cobrand, $row->lang, 'confirm_report_sent.txt'); - my $result = FixMyStreet::App->send_email_cron( + FixMyStreet::App->send_email_cron( { _template_ => $template, _parameters_ => $h, @@ -509,7 +508,6 @@ sub _send_report_sent_email { From => mySociety::Config::get('CONTACT_EMAIL'), }, mySociety::Config::get('CONTACT_EMAIL'), - [ $row->user->email ], $nomail, $cobrand ); diff --git a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm index b7af9e60e..646967bfc 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm @@ -5,7 +5,6 @@ use strict; use warnings; use Encode; use Utils; -use mySociety::EmailUtil; sub send_questionnaires { my ( $rs, $params ) = @_; @@ -103,11 +102,10 @@ sub send_questionnaires_period { From => [ $sender, $sender_name ], }, $sender, - [ $row->user->email ], $params->{nomail}, $cobrand ); - if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) { + unless ($result) { print " ...success\n" if $params->{verbose}; $row->update(); $token->insert(); |