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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With