How to tell if Rails action mailer deliver fails?

actionmailer, ruby, ruby-on-rails

Solution

As described in http://guides.rubyonrails.org/action_mailer_basics.html, you can set

config.action_mailer.raise_delivery_errors = true

this way, Rails will raise an error in case the delivery can't take place

Problem

In my project, I'm using Rails 4.1.1 and Ruby 2.1.1. I was reading the `mail` gem, but wasn't sure how to check if the `deliver` failed (for any reason). ``` result = UserMailer.signup.deliver if result.action == 'failed' or result.bounced? # How can you tell if a deliver has failed? # Do stuff here if failed end ```

Original source

Related problems