From 7d04bf1b30460235075ad39305d45462c1b99a8d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 11 May 2015 16:18:13 +0100 Subject: Sensible error message --- app/models/info_request.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/info_request.rb') diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 245de1e15..0b7838219 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -921,7 +921,7 @@ public # Called by incoming_email - and used to be called to generate separate # envelope from address until we abandoned it. def magic_email(prefix_part) - raise "id required to make magic" if not self.id + raise "id required to create a magic email" if not self.id return InfoRequest.magic_email_for_id(prefix_part, self.id) end -- cgit v1.2.3 From cfed22d9a2d4fab6c8d008a74bcdf97c908384c2 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 12 May 2015 12:05:51 +0100 Subject: Add explaining comments --- app/models/info_request.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/models/info_request.rb') diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 0b7838219..f75d43010 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -427,6 +427,7 @@ public # A new incoming email to this request def receive(email, raw_email_data, override_stop_new_responses = false, rejected_reason = "") + # Is this request allowing responses? if !override_stop_new_responses allow = nil reason = nil @@ -457,6 +458,7 @@ public raise "Unknown allow_new_responses_from '" + self.allow_new_responses_from + "'" end + # 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? -- cgit v1.2.3 From da6c11531a761847ee129f92677a44fdb02de04e Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 12 May 2015 12:43:04 +0100 Subject: Discard rejected responses with malformed From: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- app/models/info_request.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/models/info_request.rb') 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' -- cgit v1.2.3