How to delete all emails older than x days?
Is there any way for cpanel users to set up a regular (automated) action to delete emails older than x days?
(Customer is using "mdbox" mail storage format.)
Thanks.
-
Hello, You can do this through the interface by going to cPanel>>Email>>Email Disk Usage and manage each email address as the cPanel Administrator. This allows you to delete emails older than X date. If you wanted to create a cron job that did this within cPanel you could with the UAPI function here: 0 -
Hello, @cPanelLauren If I add a custom dovecot query, for eg. 'savedbefore 104weeks', the emails are not deleted. Any hints? :) Thanks 0 -
Can you show me exactly what you're running? (change the actual domain name to an example) - I tested this on my own server and it worked without issue. 0 -
Error with built-in dropdown custom query chosen: [Manage] Email DIsk Usage>> Messages to delete: [Custom query...] 3 months or more older [Delete permanently] Error: "/usr/bin/doveadm" reported error code "75" when it ended: Fatal: Unknown argument MONTHS Question: why is there a cPanel-offered choice that apparently has bad syntax? ("months") (Their suggestion example: " savedbefore 2weeks" does work even tho it seemingly is missing a space, and the term "saved" isn't logical, in this case it's "received") All this is difficult to explain to complaining clients 0 -
@wsherwood - can you let me know the exact text you're placing in the custom query box so I can replicate this behavior? 0 -
3 months or more older was one of the drop down choices. If the script provides a choice, i would want it to be correct syntax/keywords. if it's not meant to be an example of syntax and instead just a loose description, then it should be labeled and offer the resulting/desired correct syntax to achieve the date range. 0 -
The reason I asked is because I'm not seeing that in the options in my interface. I'm on the latest build, which is 102.0.14, and I see this in the main area: but I don't see anything automatically populate when I either move my cursor into, or start typing into, the text box. I did test this on an account with many emails going back several years, both in Jupiter and Paper Lantern, and I'm not seeing the "3 months" option appear. Can you let me know what version of cPanel you're working with, and also provide a screenshot? 0 -
[sorry for the delay, i don't see my reply to your last message posted, grrr. I'll reconstruct it] ( this is not a showstopper, but several times a week in support roles, we guide our clients thru similar) 102.0.12 (STANDARD) CentOS v7.9.2009 [specific email account] MANAGE EMAIL ACCOUNTS Free up Email Storage Clarification/correction: the following is not a dropdown, but rather autofill choices. Perhaps therein is the predicament (it might be populating suggestions from an unrelated similarly named input field somewhere) So assuming that is the case, then the suggestion is to have a tooltip popup of syntax options more than just. ("savedbefore" is not obvious) It takes a bit of drilling down in the dovecot links to find: So assuming that is the case, then the suggestion is to have a tooltip popup of syntax options more than just. ("savedbefore" is not obvious) It takes a bit of drilling down & scrolling down in the dovecot links to find which are not obvious that this is syntax for this usage. Maybe make the link for help point directly (and only) to Tools/Doveadm/SearchQuery - Dovecot Wiki#section_date_specification Thank you! 0 -
Thanks for that - that's exactly what I needed to know. This leads me to another issue - both myself and a colleague, on two separate browsers each, aren't getting those dropdown prompts. Can you try a different browser at your location and see if you're still getting those? 0 -
you are correct. in another browser the autofill suggestions are not there. sorry for the trouble. (may i still suggest to put a link directly to the syntax options) thank you will 0 -
Can you submit a feature request using the link in my signature and I'll make sure it gets reviewed? 0 -
Step 1: First, you need to set the cron using cPanel. Now to set the cron you, open the cPanel, Scroll down Advanced > Cron jobs. Step 2: Add the command mentioned below to run in the cron. /usr/bin/archivemail "quiet "delete "days 20 /home/{USER}/mail/inbox The emails will be auto-deleted for older than 20 days using the above command. 0 -
Error with built-in dropdown custom query chosen: [Manage] Email DIsk Usage>> Messages to delete: [Custom query...] 3 months or more older [Delete permanently] Error: "/usr/bin/doveadm" reported error code "75" when it ended: Fatal: Unknown argument MONTHS Question: why is there a cPanel-offered choice that apparently has bad syntax? ("months") (Their suggestion example: " savedbefore 2weeks" does work even tho it seemingly is missing a space, and the term "saved" isn't logical, in this case it's "received") All this is difficult to explain to complaining clients
I saw this and just recently did it myself so I would provide an answer. I originally assumed like you to use the phrase "X months or more older" and kept getting the same error you did. So I decided to do "savedbefore 26weeks
" which is 6 months. And it worked. So you just have to estimate your request in weeks. Haven't tried days. But I assume if you want higher precision, you would need to use "days" or "minutes".0
Please sign in to leave a comment.
Comments
13 comments