Rescuing Net::SMTPFatalError on Devise emails
1
Not solved Solved
9 months ago

Hey guys,

I've set up my SAAS app with Devise Invitable, which allows a user to create other users by "inviting" them to join the website. An email is sent to invite them.

My problem is that if the email address doesn't exist I get a nice Net::SMTPFatalError (550 5.1.2 <nkjpj@hhopjop.com>: Recipient address rejected: Domain not found.

Is there any way to rescue this without having to fork the gem, and with some clean code ? All I want is to add a notice saying the email couldn't be sent, but the user still has to be created.

9 months ago

Does it throw in your controller code? You can rescue this Net::SMTPFatalError error, and tell the user that there was a problem with the email (here clearly the domain does not exist so the error message is clear and right)

9 months ago

If you want to be more flexible, do it by yourself, it's pretty easy. You can look at this tutorial

Cancel
Submit your answer