Skip to content

Sparkpost throws 500 when email is invalid, catching error doesn't work #39

Description

@gbrl

I followed the instructions in the README, setting up action_mailer.rb file to catch SparkPostRails::DeliveryException but it doesn't seem to work.

The issue is that if you use sparkpost with devise, and a user tries to register with an email that doesn't have any MX records... (example: user@gmails.com) sparkpost throws a DeliveryException, and my app crashes. Am I doing something wrong? Here's my action_mailer.rb file

ActionMailer::DeliveryJob.rescue_from(SparkPostRails::DeliveryException) do |exception|
  redirect_to '/logout', alert: "Please use a valid email address."
  # do something special with the error
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions