aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/SendReport/Email.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-09-27 14:46:46 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-09-30 15:04:06 +0100
commitc7d98f98bf4faa1a60552dd11195eb134445b6b3 (patch)
tree47028cce45ce2ac77c5208f18bdb02b45d7220c2 /perllib/FixMyStreet/SendReport/Email.pm
parentd0ae2a420905dbd0b79141d88e2c47956d1d65b2 (diff)
Adapt things that assume email will be present.
This includes stopping some emails being sent (moderation, alert, questionnaire), dealing with Open311/email report sending, and tokenised_url.
Diffstat (limited to 'perllib/FixMyStreet/SendReport/Email.pm')
-rw-r--r--perllib/FixMyStreet/SendReport/Email.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm
index eefb14553..0aacc14a1 100644
--- a/perllib/FixMyStreet/SendReport/Email.pm
+++ b/perllib/FixMyStreet/SendReport/Email.pm
@@ -74,14 +74,21 @@ sub send {
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($row->cobrand)->new();
my $params = {
To => $self->to,
- From => $self->send_from( $row ),
};
$cobrand->call_hook(munge_sendreport_params => $row, $h, $params);
$params->{Bcc} = $self->bcc if @{$self->bcc};
- my $sender = FixMyStreet::Email::unique_verp_id('report', $row->id);
+ my $sender;
+ if ($row->user->email && $row->user->email_verified) {
+ $sender = FixMyStreet::Email::unique_verp_id('report', $row->id);
+ $params->{From} = $self->send_from( $row );
+ } else {
+ $sender = FixMyStreet->config('DO_NOT_REPLY_EMAIL');
+ my $name = sprintf(_("On behalf of %s"), $params->{From}[1]);
+ $params->{From} = [ $sender, $name ];
+ }
if (FixMyStreet::Email::test_dmarc($params->{From}[0])
|| Utils::Email::same_domain($params->{From}, $params->{To})) {