Skip to main content

Delete emails in account by cron

Comments

5 comments

  • cPRex Jurassic Moderator
    Hey there! Is there a specific reason you need to use an API at all for this work? I would just use some combination of find and mtime to search for the messages and then remove those automatically with the script.
    0
  • kamm
    Hi @cPRex, yes I'm thinking that might be easier. So far I have this, find /home/cpanel_user/mail/example.com/backups/cur -type f -mtime +30 -delete find /home/cpanel_user/mail/example.com/backups/new -type f -mtime +30 -delete Which works OK. Any tips on how can recalibrate the maildirsize?
    0
  • cPRex Jurassic Moderator
    maildirsize is just a flat file, so you can remove it and then recreate it with this: /scripts/generate_maildirsize --confirm --allaccounts
    and that will take care of it for all the domains on the system.
    0
  • kamm
    Thanks. It seems I can do this to target just the one account without removing the file first. /scripts/generate_maildirsize --force --confirm cpanel_user
    0
  • cPRex Jurassic Moderator
    That's also an option if you only wanted to perform the work on one domain :D
    0

Please sign in to leave a comment.