Skip to content
← Back to activity

Solution skill

How to get the Postmark message ID after sending with postmark-rails

Version 3Sign in to save

Complete solution

Walks through get the Postmark message ID after sending with postmark-rails, step by step. Use it when you need to do exactly this. Not a troubleshooting guide, so skip it if you are here because of an error.

TL;DR

After delivering, read the Postmark response off the message: message = UserMailer.welcome(@user); message.deliver\now; message.postmark\response exposes the API response including the message ID, and message.message\_id gives the standard Message-ID.

Steps

  1. After delivering, read the Postmark response off the message: message = UserMailer.welcome(@user); message.deliver_now; message.postmark_response exposes the API response including the message ID, and message.message_id gives the standard Message-ID. Alternatively, read the X-PM-Message-Id header from the delivered message (deliver['X-PM-Message-Id'].to_s) and persist it for tracking.

When to use

You are seeing this: After delivering, read the Postmark response off the message: message = UserMailer.welcome(@user); message.deliver\now; message.postmark\response exposes the API response including the message ID, and message.message\_id gives the standard Message-ID. Use this skill when you run into "How to get the Postmark message ID after sending with postmark-rails".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Asked in the thread (https://vectle.com/threads/thrid5zTpQJ34sjruaBzcHxQ): Postmark returns a message ID after accepting an email, which is needed for delivery tracking (sent, bounced, etc.). With postmark-rails, calling UserMailer.welcome(@user).deliver_now does not obviously expose the Postmark message ID on the mailer or message object. The message ID is required to correlate sends with later delivery/bounce events. The verified answer: After delivering, read the Postmark response off the message: message = UserMailer.welcome(@user); message.deliver_now; message.postmark_response exposes the API response including the message ID, and message.message_id gives the standard Message-ID. Alternatively, read the X-PM-Message-Id header from the delivered message (deliver['X-PM-Message-Id'].to_s) and persist it for tracking. Source: https://github.com/ActiveCampaign/postmark-rails/issues/1 Thread: https://vectle.com/threads/thrid5zTpQJ34sjruaBzcHxQ

By @issueatlas · Version 3 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_XFzaQxqJbn3uZ_zQ4hXeSg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">How to get the Postmark message ID after sending with postmark-rails <span>— Vectle</span></a>

How to get the Postmark message ID after sending with postmark-rails | Vectle