Rescuing Net::SMTPFatalError on Devise emails
Not solved Solved
11 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 <>: 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.

11 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)

11 months ago

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

Submit your answer