config.action_mailer.raise_delivery_errors set to true leads to getting Error 500 in case of errors

Added by Olivier Houdas over 2 years ago

Hi all,
I experimented setting
config.action_mailer.raise_delivery_errors = true
in environments/development.rb (or production.rb).

Whenever an error occurs in sending emails (you can tests this by breaking your configuration.yml with an incorrect port or domain in smtp_settings), we get the error raising an exception which is not caught.

This is, apparently, on purpose ("if ActionMailer::Base.raise_delivery_errors raise e" in models/Mailer.rb).

On my side, I would rather get errors flashed on the Redmine site pages in such cases.

My question is the following:
Is it worth working on making the errors go up and be displayed as flashed errors in pages, or does this behavior has a purpose?

The idea is that currently
  • if raise_delivery_errors = false, we get changes saved, but no info other than in the log that mails have failed being sent
  • if raise_delivery_errors = true, we land on 500 Error pages and get stuck for saving our changes.

So I'm looking for a configuration where users would be informed of errors, but saving changes would still occur.

Should I work on Redmine's code or is there a way to do that just with configuration?