Feature #32519

Report more precise error in failed requests (bounced emails) from incoming emails

Added by Anthony Mallet about 3 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:


Category:Email receiving
Target version:-


When a user sends an invalid e-mail to rdm-mailhandler.rb, for instance with invalid project
id or missing mandatory fields, the bounced e-mail is not helpful, as it just says:

"Request was denied by your Redmine server. "
"Possible reasons: email is sent from an invalid email address or is missing some information."

And, from experience, users have hard times understanding what they got wrong.
I propose to report the actual error message so that it appears in the bounce e-mail.

Here is a quick patch that tries to avoid breaking the API of existing methods. It passes an
optional array to MailHandler.receive(), that is filled with error messages, so that
MailHandler.receive() can continue to return a boolean. Then it renders the message in the
body response of the 'unprocessable_entity' error if there is an error. rdm-mailhandler.rb
is also patched to get the response body and send it to stderr so that the MTA gets it.

There might be a cleaner way to implement this, but I tried to make it simple for now :)

mail-err.patch Magnifier - Report error message in rdm-mailhandler.rb (5.41 KB) Anthony Mallet, 2019-11-26 17:36

Also available in: Atom PDF