[GH-ISSUE #338] Feature Request - Add option to Control Message Retention by Age (TTL) #228

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

Originally created by @alexkved on GitHub (Jul 30, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/338

Description
Currently, Mailpit allows users to limit the maximum number of email messages stored using the MP_MAX_MESSAGES option. However, some users would prefer to control the retention of messages based on their age. For example, automatically deleting messages older than a specified number of hours or days.

Proposed Solution
Introduce a new option MP_MAX_MESSAGE_AGE that specifies the maximum age of messages to be retained in Mailpit. Messages older than this age should be automatically deleted.

Option:
MP_MAX_MESSAGE_AGE: Specifies the maximum age of messages in hours or days. For example, 72h to retain messages for 72 hours or 3d for 3 days.

Benefits

  • Provides more flexible message retention policies based on message age.
  • Helps manage storage by automatically cleaning up older messages.
  • Ensures compliance with policies requiring the deletion of older messages.

Example Usage:

docker run -d \
  -e MP_MAX_MESSAGE_AGE=72h \
  -p 8025:8025 \
  axllent/mailpit
Originally created by @alexkved on GitHub (Jul 30, 2024). Original GitHub issue: https://github.com/axllent/mailpit/issues/338 **Description** Currently, Mailpit allows users to limit the maximum number of email messages stored using the `MP_MAX_MESSAGES` option. However, some users would prefer to control the retention of messages based on their age. For example, automatically deleting messages older than a specified number of hours or days. **Proposed Solution** Introduce a new option `MP_MAX_MESSAGE_AGE` that specifies the maximum age of messages to be retained in Mailpit. Messages older than this age should be automatically deleted. **Option:** `MP_MAX_MESSAGE_AGE`: Specifies the maximum age of messages in hours or days. For example, 72h to retain messages for 72 hours or 3d for 3 days. **Benefits** - Provides more flexible message retention policies based on message age. - Helps manage storage by automatically cleaning up older messages. - Ensures compliance with policies requiring the deletion of older messages. **Example Usage:** ``` docker run -d \ -e MP_MAX_MESSAGE_AGE=72h \ -p 8025:8025 \ axllent/mailpit ```
kerem 2026-03-15 13:20:02 +03:00
Author
Owner

@axllent commented on GitHub (Jul 30, 2024):

Thanks for your suggestion @alexkved, this makes sense to me. I do not have an ETA as I'm working on another big task right now, but I'll add this to my "TODO" list 👍

<!-- gh-comment-id:2258842016 --> @axllent commented on GitHub (Jul 30, 2024): Thanks for your suggestion @alexkved, this makes sense to me. I do not have an ETA as I'm working on another big task right now, but I'll add this to my "TODO" list :+1:
Author
Owner

@alexkved commented on GitHub (Jul 31, 2024):

Thank you for considering this feature request. We appreciate your time and effort in reviewing it, and we look forward to any updates you might have on this in the future.

<!-- gh-comment-id:2259826104 --> @alexkved commented on GitHub (Jul 31, 2024): Thank you for considering this feature request. We appreciate your time and effort in reviewing it, and we look forward to any updates you might have on this in the future.
Author
Owner

@axllent commented on GitHub (Aug 6, 2024):

This feature has been released in v1.20.0. Please see the release notes and linked documentation, and let me know if this works for you? Thanks.

<!-- gh-comment-id:2270542992 --> @axllent commented on GitHub (Aug 6, 2024): This feature has been released in [v1.20.0](https://github.com/axllent/mailpit/releases/tag/v1.20.0). Please see the release notes and linked documentation, and let me know if this works for you? Thanks.
Author
Owner

@alexkved commented on GitHub (Aug 7, 2024):

@axllent , thank you very much for your effort. It works like a charme.

<!-- gh-comment-id:2272718046 --> @alexkved commented on GitHub (Aug 7, 2024): @axllent , thank you very much for your effort. It works like a charme.
Author
Owner

@axllent commented on GitHub (Aug 7, 2024):

That's great to hear, thanks for the feedback!

<!-- gh-comment-id:2272724451 --> @axllent commented on GitHub (Aug 7, 2024): That's great to hear, thanks for the feedback!
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#228
No description provided.