-
Notifications
You must be signed in to change notification settings - Fork 71
Accessing Postmark Message ID
Each email message sent by Postmark will contain a unique Postmark message ID. In case of email messages, identifier is stored within X-PM-Message-ID header.
This identifier can be used to for things like retrieving bounce detailslater.
The example below shows you how to access the Postmark Message ID from sent email headers.
server_token = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
client = Postmark::ApiClient.new(server_token)
message = Mail.new
# ...
client.deliver_message(message)
message['X-PM-Message-ID'].to_s
# => cadba131-f6d6-4cfc-9892-16ee738ba54c
You can also access Postmark message ID from sent email response. In this case, identifier is accessible by :message_id
.
client.deliver({from: '[email protected]', to: '[email protected]', html_body: 'test', subject: 'Welcome email'})
{:to=>"[email protected]",
:submitted_at=>"2021-07-05T12:55:25.6949168Z",
:message_id=>"123456-111c-111-1234567890",
:error_code=>0,
:message=>"OK"}
Postmark message id is stored within "X-PM-Message-ID" header, not "Message-ID" header of the email sent for reason of not altering any identifiers which are not Postmark related. Postmark related headers will always start with "X-PM" to not interfere any other headers.
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.
- Email sending
- Test email sending
- Bounces
- Templates
- Templates push
- Server
- Servers
- Message Streams
- Webhooks
- Messages
- Domains
- Sender Signatures
- Stats
- Trigger Tags
- Suppressions
- Data Removals
- Trigger Inbound Rules
- Parsing Inbound
- Using Postmark with Mail library
- Accessing Postmark Message ID
- Error Handling
- Integration Testing
- Troubleshooting
- Known issues and how to resolve them