Delete old email messages older than 30days

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


    JULINT Member

    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/*/cur -type f -mtime +30 -exec rm -f {} \;

    Please help me , where is the path of email messages

  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    The mail folders are usually under /var/vmail/ 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

    JULINT Member

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

    florian030 ISPConfig Developer ISPConfig Developer

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

Share This Page