[GH-ISSUE #33] Feature suggestion: optionally delete emails after they reach a certain age? #20

Closed
opened 2026-02-25 23:39:37 +03:00 by kerem · 2 comments
Owner

Originally created by @Dan-Q on GitHub (Aug 12, 2021).
Original GitHub issue: https://github.com/HaschekSolutions/opentrashmail/issues/33

I'd like to be able to set an environment variable, e.g. MAXAGE, to say how many days old an email should be before it's deleted. An automated job can then delete ones over that age.

(My opentrashmail server gathered multiple gigabytes of junk!)

Originally created by @Dan-Q on GitHub (Aug 12, 2021). Original GitHub issue: https://github.com/HaschekSolutions/opentrashmail/issues/33 I'd like to be able to set an environment variable, e.g. `MAXAGE`, to say how many days old an email should be before it's deleted. An automated job can then delete ones over that age. (My opentrashmail server gathered multiple gigabytes of junk!)
kerem closed this issue 2026-02-25 23:39:37 +03:00
Author
Owner

@geek-at commented on GitHub (Aug 12, 2021):

love the idea, as I'm having the same problems on my public instance. Also should implement all emails to non-configured domains should be discarded

<!-- gh-comment-id:897975448 --> @geek-at commented on GitHub (Aug 12, 2021): love the idea, as I'm having the same problems on my public instance. Also should implement all emails to non-configured domains should be discarded
Author
Owner

@Dan-Q commented on GitHub (Nov 9, 2021):

In the meantime (for anybody who wants to hack something together on their own box), I've manually added the following script to /etc/periodic/daily/delete-old-mail to delete mail older than 7 days:

#!/bin/sh
find /var/www/opentrashmail/data/* -mtime +7 -delete

It's a bit clunky (and will do stupid things like trying to delete directories before it deletes the files within them, but that fixes itself the next day) but it stops the server getting bogged down.

<!-- gh-comment-id:964080775 --> @Dan-Q commented on GitHub (Nov 9, 2021): In the meantime (for anybody who wants to hack something together on their own box), I've manually added the following script to `/etc/periodic/daily/delete-old-mail` to delete mail older than 7 days: ```sh #!/bin/sh find /var/www/opentrashmail/data/* -mtime +7 -delete ``` It's a bit clunky (and will do stupid things like trying to delete directories before it deletes the files within them, but that fixes itself the next day) but it stops the server getting bogged down.
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/opentrashmail#20
No description provided.