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

## The problem

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 fix

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