axllent / mailpit

An email and SMTP testing tool with API for developers
https://mailpit.axllent.org
MIT License
5.7k stars 139 forks source link

Feature Request - Add option to Control Message Retention by Age (TTL) #338

Closed alexkved closed 3 months ago

alexkved commented 3 months ago

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

Example Usage:

docker run -d \
  -e MP_MAX_MESSAGE_AGE=72h \
  -p 8025:8025 \
  axllent/mailpit
axllent commented 3 months ago

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:

alexkved commented 3 months ago

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.

axllent commented 3 months ago

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.

alexkved commented 3 months ago

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

axllent commented 3 months ago

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