aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r--perllib/FixMyStreet/App/Controller/Contact.pm15
-rw-r--r--perllib/FixMyStreet/App/Controller/Moderate.pm4
2 files changed, 12 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm
index 912224649..115f4e3d2 100644
--- a/perllib/FixMyStreet/App/Controller/Contact.pm
+++ b/perllib/FixMyStreet/App/Controller/Contact.pm
@@ -5,6 +5,7 @@ use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller'; }
use mySociety::EmailUtil;
+use FixMyStreet::Email;
=head1 NAME
@@ -239,11 +240,19 @@ sub send_email : Private {
? ' ( forwarded from ' . $c->req->header('X-Forwarded-For') . ' )'
: '';
- $c->send_email( 'contact.txt', {
+ my $from = [ $c->stash->{em}, $c->stash->{form_name} ];
+ my $params = {
to => [ [ $recipient, _($recipient_name) ] ],
- from => [ $c->stash->{em}, $c->stash->{form_name} ],
subject => 'FMS message: ' . $c->stash->{subject},
- });
+ };
+ if (FixMyStreet::Email::test_dmarc($c->stash->{em})) {
+ $params->{'Reply-To'} = [ $from ];
+ $params->{from} = [ $recipient, $c->stash->{form_name} ];
+ } else {
+ $params->{from} = $from;
+ }
+
+ $c->send_email('contact.txt', $params);
# above is always succesful :(
$c->stash->{success} = 1;
diff --git a/perllib/FixMyStreet/App/Controller/Moderate.pm b/perllib/FixMyStreet/App/Controller/Moderate.pm
index 08c4280a1..77a3346dc 100644
--- a/perllib/FixMyStreet/App/Controller/Moderate.pm
+++ b/perllib/FixMyStreet/App/Controller/Moderate.pm
@@ -102,9 +102,6 @@ sub report_moderate_audit : Private {
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($problem->cobrand)->new();
- my $sender = FixMyStreet->config('DO_NOT_REPLY_EMAIL');
- my $sender_name = _($cobrand->contact_name);
-
my $token = $c->model("DB::Token")->create({
scope => 'moderation',
data => { id => $problem->id }
@@ -113,7 +110,6 @@ sub report_moderate_audit : Private {
$c->send_email( 'problem-moderated.txt', {
to => [ [ $user->email, $user->name ] ],
- from => [ $sender, $sender_name ],
types => $types_csv,
user => $user,
problem => $problem,