aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2015-05-12 12:43:04 +0100
committerGareth Rees <gareth@mysociety.org>2015-05-13 10:53:10 +0100
commitda6c11531a761847ee129f92677a44fdb02de04e (patch)
treea0722942ab0907cc974b08c25f431245cc4a14e9 /app/models/info_request.rb
parentcfed22d9a2d4fab6c8d008a74bcdf97c908384c2 (diff)
Discard rejected responses with malformed From:
Stops the RequestMailer trying to send a stopped_responses mail if the To: address can’t be parsed from the incoming message. ArgumentError: An SMTP To address is required to send a message. Set the message smtp_envelope_to, to, cc, or bcc address.
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index f75d43010..c203f75c3 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -461,7 +461,12 @@ public
# If its not allowing responses, handle the message
if !allow
if self.handle_rejected_responses == 'bounce'
- RequestMailer.stopped_responses(self, email, raw_email_data).deliver if !is_external?
+ if MailHandler.get_from_address(email).nil?
+ # do nothing – can't bounce the mail as there's no
+ # address to send it to
+ else
+ RequestMailer.stopped_responses(self, email, raw_email_data).deliver if !is_external?
+ end
elsif self.handle_rejected_responses == 'holding_pen'
InfoRequest.holding_pen_request.receive(email, raw_email_data, false, reason)
elsif self.handle_rejected_responses == 'blackhole'