diff options
author | Dave Arter <davea@mysociety.org> | 2016-07-28 16:53:56 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-07-28 16:53:56 +0100 |
commit | 14aaf6fafaa9aa8736f49851e95fa2c3c566c056 (patch) | |
tree | fc1afeae6c1e82494044465cbf99a3ffdb893141 | |
parent | 07d2c0f3e4b94ec8824a6f592dc586d71392db20 (diff) |
[Zurich] Send admin emails from the do-not-reply address
Also takes the opportunity to fix the incorrectly-encoded sender name which
was appearing to some clients as "Züri Wie Neu".
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 7 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 1bf9cb9a5..cc40cde29 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -994,10 +994,9 @@ sub _admin_send_email { ? [ $problem->user->email, $problem->name ] : $problem->user->email; - # Similar to what SendReport::Zurich does to find address to send to - my $body = ( values %{$problem->bodies} )[0]; - my $sender = $body->endpoint || $c->cobrand->contact_email; - my $sender_name = $c->cobrand->contact_name; # $body->name? + my $sender = FixMyStreet->config('DO_NOT_REPLY_EMAIL'); + my $sender_name = $c->cobrand->contact_name; + utf8::decode($sender_name) unless utf8::is_utf8($sender_name); $c->send_email( $template, { to => [ $to ], diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index e16738b30..f1540e2b8 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -472,7 +472,7 @@ $mech->content_contains('FINAL UPDATE'); $email = $mech->get_email; like $email->header('To'), qr/test\@example.com/, 'to line looks correct'; -like $email->header('From'), qr/division\@example.org/, 'from line looks correct'; +like $email->header('From'), qr/do-not-reply\@example.org/, 'from line looks correct'; like $email->body, qr/FINAL UPDATE/, 'body looks correct'; $mech->clear_emails_ok; |