rescue email failurs rails code example
Example: rails catch mail error
begin
UserMailer.welcome_email(@user).deliver
flash[:success] = "#{@user.name} created"
rescue Net::SMTPAuthenticationError, Net::SMTPServerBusy, Net::SMTPSyntaxError, Net::SMTPFatalError, Net::SMTPUnknownError => e
flash[:success] = "Utente #{@user.name} creato. Problems sending mail"
end