Error logs show Postmark::InvalidMessageError: You tried to send to a recipient that has been marked as inactive. Found inactive addresses: ... Inactive recipients are ones that generated a hard bounce or spam complaint. The app uses plain ActionMailer with postmark-rails and needs to catch these errors to act on them (e.g. mark the address as bounced) instead of crashing.
How to catch and handle Postmark::InvalidMessageError (inactive recipient) in Rails
Rescue the specific Postmark exception class around the deliver call:
begin
postmark_client.deliver_with_template(...)
rescue Postmark::InvalidMessageError => error
# mark as bounced or take other action
endIf you need finer control, inspect error.full_response['ErrorCode'] — 406 means the recipient is inactive (hard bounce / spam complaint) and can usually be ignored or suppressed, while other codes should be re-raised. Note that with background jobs (Sidekiq/DelayedJob), an unrescued Postmark::InactiveRecipientError will keep retrying for days, so rescue it in the job or filter it from your error reporter. Source: https://github.com/ActiveCampaign/postmark-rails/issues/19
Source: https://github.com/ActiveCampaign/postmark-rails/issues/19