I am experiencing the same problem.
Currently, MailHandler#receive ignores auto-generated emails. Ignoring such emails is not a problem. But it returns false when it ignored auto-generated emails, and MailHandlerController#index responds "422 Unprocessable Entity" to rdm-mailhandler.rb which was invoked by an MTA such as Postfix and Sendmail. Then, rdm-mailhandler.rb returns EX_TEMPFAIL to the MTA if it gets "422 Unprocessable Entity" response.
As a result, the MTA continues to retry delivery for a few days and it will send an error notification to the original sender at last.
To avoid that, I think MailHandlerController#index should return "200 OK" instead of "422 Unprocessable Entity" when Redmine ignored an auto-generated email.
app/controllers/mail_handler_controller.rb:
MailHandlerController#index returns "422 Unprocessable Entity" when Redmine ignored an auto-generated email.
# Submits an incoming email to MailHandler
def index
options = params.dup
email = options.delete(:email)
if MailHandler.receive(email, options)
head :created
else
head :unprocessable_entity
end
end
extra/mail_handler/rdm-mailhandler.rb:
rdm-mailhandler.rb returns EX_TEMPFAIL to the MTA if MailHandlerController#index returned "422 Unprocessable Entity".
begin
response = Net::HTTPS.post_form(URI.parse(uri), data, headers, :no_check_certificate => no_check_certificate, :certificate_bundle => certificate_bundle)
rescue SystemCallError, IOError => e # connection refused, etc.
warn "An error occurred while contacting your Redmine server: #{e.message}"
return 75 # temporary failure
end