Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6692001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:49:02+00:00 2026-05-26T05:49:02+00:00

I am using Postmark to handle all email in my Rails 3 app, using

  • 0

I am using Postmark to handle all email in my Rails 3 app, using postmark-rails gem.

Now and then an user introduces a wrong email or a non-existing one with ends up giving hardbounces. Postmark raises Postmark::InvalidMessageError errors to handle this issue, that my users receive as a non-descriptive 500 error.

I’d like to handle those errors into my responsive interface and I was wondering what would be the best strategy. I have now a few mailers already with several dozens amongst all, so I don’t want to add begin-raise blocks to all those methods. Adding this begin-raise to controllers also doesn’t seem the most elegant solution.

I’ve been reading about adding a rescue_from block to my ApplicationController, but then I don’t know how to handle this in the interface (maybe by calling a method that uses errors method?)

I’d like to listen to your thoughts before plumbering.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:49:02+00:00Added an answer on May 26, 2026 at 5:49 am

    We had to deal with the same problem in Beanstalk. First of all we turned off “raise_delivery_errors” in production then we implemented an override method for ActionMailer::Base that allowed us to change that setting on the fly for specific deliveries. Like this:

    AccountMailer.raise_errors do
      AccountMailer.deliver_welcome_email(@account)
    end
    

    That allowed us to control when exactly we want delivery exceptions appearing and avoid problems when such errors were breaking something they shouldn’t. Usually there are only one or two places where you’d want to put that override. In our case it’s Forget Password and Invite User functions, when it’s crucial to let users know that their password reset email/invitation wasn’t delivered. Having a delivery exceptions somewhere inside a background-running job doesn’t help anyone.

    After we had that in place we added a rescue_from to our ApplicationController that would set flash[:alert] and redirect back.

    def postmark_delivery_error(exception)
      if address = derive_email_from_postmark_exception(exception)
        link = %Q[<a href="#{ reactivate_email_bounce_path(address)  }">reactivating</a>]
        msg = "We could not deliver a recent message to “#{ address }”. The email was disabled due to a hard bounce or a spam complaint. You can try #{ link } it and try again."
      else
        msg = "We could not deliver a recent message. The email was disabled due to a hard bounce or a spam complaint. Please contact support."
      end
      flash[:alert] = msg
      redirect_to :back
    end
    

    reactivate_email_bounce_path links to a controller that uses Postmark API to reactivate bounces. You can find more details about it here:

    http://developer.postmarkapp.com/developer-bounces.html

    So after you have all that in place your end user can have a pretty nice experience dealing with delivery errors, something that’s not usually addressed in web apps. It looks like this in Beanstalk:

    Beanstalk reactive bounce

    And not only a user can see that his email bounced, he can also reactive it himself:

    Beanstalk reactivate bounce

    Hope this helps.

    Ilya Sabanin
    http://twitter.com/isabanin

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
Using C#, I need a class called User that has a username, password, active
Using Rails 3.2.0 with haml and sass: I Would like to link an external
Using Rails 3.2.0 with haml, sass and coffeescript: Basically I am trying to disable
Using jQuery, how do I get the value from a textbox and then load
Using Xcode4.2.1, with a basic PhoneGap template based app. (I say template, but I
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
using a binary search tree I need to add to a vector all int
Using php/html, I want to retrieve email addresses (plus other information) from MySQL and
I am sending mail to the users using actionmailer through postmark. This is my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.