[GH-ISSUE #515] Option to preserve original Message-ID when releasing messages #332

Closed
opened 2026-03-15 13:55:20 +03:00 by kerem · 7 comments
Owner

Originally created by @gache001 on GitHub (Jun 6, 2025).
Original GitHub issue: https://github.com/axllent/mailpit/issues/515

Hello,

We are integrating Mailpit into our testing environments where messages are captured before being relayed to end users.

Our backend system (Mailman) generates a unique Message-ID and stores it in OpenSearch for tracking. When users reply to those emails, Mailman uses the In-Reply-To header to associate replies with the original sent message via its Message-ID.

Currently, when releasing a message via Mailpit’s UI/API, a new Message-ID is assigned. This breaks our threading because the In-Reply-To header no longer points to any known Message-ID in our system.

We understand this behavior is by design for testing Gmail, etc., but we’d like to request a configuration option to preserve the original Message-ID when relaying/releasing.

Why this matters:

  1. We want to avoid reverting to Mailhog, which is no longer maintained.

  2. Accurate threading is critical to our QA and automated testing processes.

  3. Mailpit is actively maintained and this would make it a robust fit for systems that depend on Message-ID continuity.

Kindly advise, and thanks for your awesome work on Mailpit!

Originally created by @gache001 on GitHub (Jun 6, 2025). Original GitHub issue: https://github.com/axllent/mailpit/issues/515 Hello, We are integrating Mailpit into our testing environments where messages are captured before being relayed to end users. Our backend system (Mailman) generates a unique Message-ID and stores it in OpenSearch for tracking. When users reply to those emails, Mailman uses the In-Reply-To header to associate replies with the original sent message via its Message-ID. Currently, when releasing a message via Mailpit’s UI/API, a new Message-ID is assigned. This breaks our threading because the In-Reply-To header no longer points to any known Message-ID in our system. We understand this behavior is by design for testing Gmail, etc., but we’d like to request a configuration option to preserve the original Message-ID when relaying/releasing. Why this matters: 1. We want to avoid reverting to Mailhog, which is no longer maintained. 2. Accurate threading is critical to our QA and automated testing processes. 3. Mailpit is actively maintained and this would make it a robust fit for systems that depend on Message-ID continuity. Kindly advise, and thanks for your awesome work on Mailpit!
kerem 2026-03-15 13:55:20 +03:00
Author
Owner

@axllent commented on GitHub (Jun 6, 2025):

Hi @gache001 . That makes sense, and it is definitely an option I can add. Your timing is a bit unfortunate as I just released a new version of Mailpit a few hours ago, so this will need to wait about a week until the next release (I try not to release too often unless there is a serious bug). I will keep you posted.

<!-- gh-comment-id:2950665883 --> @axllent commented on GitHub (Jun 6, 2025): Hi @gache001 . That makes sense, and it is definitely an option I can add. Your timing is a bit unfortunate as I just released a new version of Mailpit a few hours ago, so this will need to wait about a week until the next release (I try not to release too often unless there is a serious bug). I will keep you posted.
Author
Owner

@axllent commented on GitHub (Jun 6, 2025):

I have just added this feature, although as I explained earlier it will only be included in the next release which is likely a week away. If you are keen to use or test this in the meantime however, and use Docker, then you can use the latest axllent/mailpit:edge Docker image. The option must be set via either the relay yaml config file with preserve-message-ids: true, or the environment variable MP_SMTP_RELAY_PRESERVE_MESSAGE_IDS=true, depending how you are configuring your relay.

<!-- gh-comment-id:2951241934 --> @axllent commented on GitHub (Jun 6, 2025): I have just added this feature, although as I explained earlier it will only be included in the next release which is likely a week away. If you are keen to use or test this in the meantime however, and use Docker, then you can use the latest `axllent/mailpit:edge` Docker image. The option must be set via either the relay yaml config file with `preserve-message-ids: true`, or the environment variable `MP_SMTP_RELAY_PRESERVE_MESSAGE_IDS=true`, depending how you are configuring your relay.
Author
Owner

@gache001 commented on GitHub (Jun 7, 2025):

Awesome, thanks so much for this quick addition!

<!-- gh-comment-id:2951278178 --> @gache001 commented on GitHub (Jun 7, 2025): Awesome, thanks so much for this quick addition!
Author
Owner

@axllent commented on GitHub (Jun 7, 2025):

You're welcome. If you are in a position to test using the Docker edge build, then I would appreciate confirmation that it works as expected, thanks.

<!-- gh-comment-id:2951607796 --> @axllent commented on GitHub (Jun 7, 2025): You're welcome. If you are in a position to test using the Docker edge build, then I would appreciate confirmation that it works as expected, thanks.
Author
Owner

@gache001 commented on GitHub (Jun 9, 2025):

Hi,

Message-IDs are being preserved now with edge. Thanks so much!
Will go ahead and close this issue.

<!-- gh-comment-id:2955786332 --> @gache001 commented on GitHub (Jun 9, 2025): Hi, Message-IDs are being preserved now with edge. Thanks so much! Will go ahead and close this issue.
Author
Owner

@axllent commented on GitHub (Jun 9, 2025):

Great, thanks for testing. You can switch back to stable / :latest releases once the new version comes out this weekend.

<!-- gh-comment-id:2956654744 --> @axllent commented on GitHub (Jun 9, 2025): Great, thanks for testing. You can switch back to stable / :latest releases once the new version comes out this weekend.
Author
Owner

@axllent commented on GitHub (Jun 14, 2025):

This feature has now been released in v1.26.1 and the documentation updated.

<!-- gh-comment-id:2972307182 --> @axllent commented on GitHub (Jun 14, 2025): This feature has now been released in [v1.26.1](https://github.com/axllent/mailpit/releases/tag/v1.26.1) and [the documentation](https://mailpit.axllent.org/docs/configuration/smtp-relay/) updated.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#332
No description provided.