Delete old email messages older than 30days

Discussion in 'Installation/Configuration' started by JULINT, Oct 20, 2021.

  1. JULINT

    JULINT Member

    Hi,
    I want to make shell script to delete old email messages in ubuntu 20.04 and using ispconfig.
    But i don't know where is the path of email messages.

    I want to create shell script to execute command like below
    find /home/username/mail/yourdomain.com/*/cur -type f -mtime +30 -exec rm -f {} \;

    Please help me , where is the path of email messages

    Thanks
     
  2. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    The mail folders are usually under /var/vmail/domain.com/user/Maildir/ on an ispconfig system. If you use dovecot, you may be able to use doveadm to look up the user home (eg. 'doveadm user [email protected]').
     
    Last edited: Oct 20, 2021
  3. JULINT

    JULINT Member

    Hi Jesse,
    Thanks for your help.
    I will try it now
     
  4. florian030

    florian030 Well-Known Member HowtoForge Supporter

    Remove Mails from Trash:
    Code:
    doveadm expunge -u EMAIL mailbox Trash sentbefore 30d
    doveadm purge -u EMAIL
    
     

Share This Page