-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to we catch and handle Postmark::InvalidMessageError #19
Comments
Hey, Address becomes inactive when the recipient address has generated a hard bounce (e.g. address does not exists) or when the recipient declares your email as a spam. Address can be reactivated if it is due to bounce (if it is due to spam complaint, you can only reactivate by contacting our support - this is to protect people from getting spam messages). You can reactivate those inactive emails by using the API. Check out the docs at http://developer.postmarkapp.com/developer-bounces.html#activate-a-bounce. Otherwise you have to mark those recipients as inactive in your database. Thanks, |
Sorry but that doesn't answer the question. How do we handle the exception in rails? Sent from my iPhone On Oct 3, 2012, at 12:31 PM, Artem Chistyakov notifications@github.com wrote:
|
I'm not sure what your question is about. You can handle these errors the same way you would handle any other exception in Ruby. Wrap your #deliver call with begin/rescue and then log them somewhere, reactivate automatically or do whatever you need. You can introduce a new BaseMailer class and override
Let me know if I can provide any other help on this. |
Maybe what you are asking for is something like this:
|
@davidpelaez @temochka Is there a way to capture these errors in the application_controller.rb rather than putting a begin-recue at every e-mail call? That just feels clunky to me. I tried
but this doesn't seem to work. I am still getting 500 errors in my newrelic logs. |
Anyone? @davidpelaez @temochka |
Has anyone got this working along with DelayedJob? I'd like to mark invitations sent to failing emails as so and we are only sending emails through background processes ... I think that DelayedJob exception handling must be patched, but I cannot find any suitable solution out there. Thanks! |
@dgilperez did you ever get this working with DJ? We tried but were getting all sorts of odd errors, such as the method we created that we called with DJ didnt exist. Thanks. |
@noctivityinc could you please mail us at support@postmarkapp.com with some additional details about your setup? (i.e. Ruby version, Rails version, DJ version, postmark&postmark-rails gem version). We’re not aware of any problems when using the gem with Delayed Job. |
@noctivityinc sorry, I tried for a while and then stalled the task ... I'd be interested in any solution you can find! |
We would also be interested in handling these within a delayedjob configuration. |
Yeah that would be great. That largest problem with the recommended solution is that DJ reports (via Airbrake or Exceptional or whatever) the DJ caught error, NOT the actual error that occurred. This makes it extremely difficult to debug. |
@temochka’s link seems to be old, this seems to be the new one: http://developer.postmarkapp.com/developer-api-bounce.html#activate-bounce |
Found a way to catch these:
this is what
|
This works fine for us....Rails 4.2 sending with a Postmark Template through Delayed Job. You can just match the specific class of Postmark error you want to rescue.
|
Sorry to comment on such an old issue, but in my case some To prevent this from happening in the future, I ignored the exception in my Raven configuration:
UPDATE: Actually this just prevents the error from making it to Sentry, but the Sidekiq jobs will continue being retried until they get stale. This LAST UPDATE: The wiki has a section about error handling. I should have read that first! |
I noticed in my error log today a number of these:
Since we don't do anything special except use Rails 2.3's normal ActiveMailer for sending mail, how do we capture and act on these errors that the Gem is returning?
The text was updated successfully, but these errors were encountered: