Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Automatic deletion of emails with cron

Discussion in 'E-mail Discussion' started by iorbita, Jun 4, 2018.

  1. iorbita

    iorbita Registered

    Joined:
    Jun 4, 2018
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Pescara
    cPanel Access Level:
    Website Owner
    Hello,
    I have to delete emails older than 90 days with a specific email subject.

    Another solution would be to target emails that were previously moved to a specific folder, in this case the idea would be to target the folder concerned.

    The cron script that is proposed in this thread seems to suit me, it’s just missing the specific subject to target or, in the other case, the specific folder to target.

    Do you have a script to advise me? Many thanks.

    Lorenzo
     
  2. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,424
    Likes Received:
    98
    Trophy Points:
    103
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @iorbita

    Looking at that command it does indicate the specific folder that you'd be targeting:

    Code:
    /home/SERVER_LOGIN_USERNAME/mail/DOMAIN_NAME/MAIL_ACCOUNT_NAME/cur
    It's removing mail from cur. You can change that to any one of the folders that are present in the mail directory for the domain for example:

    Code:
    find /home/%user/mail/example.com/mailuser/new -type f -mtime +90 -exec rm {} \;
    This would remove all mail older than 90 days in /home/$user/mail/example.com/mailuser/new

    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. iorbita

    iorbita Registered

    Joined:
    Jun 4, 2018
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Pescara
    cPanel Access Level:
    Website Owner
    ... thank you very much for your reply! ;)
     
  4. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,424
    Likes Received:
    98
    Trophy Points:
    103
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @iorbita

    You're very welcome, I'm glad I could help!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice