Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Mail Server
  • Search

Removing mails from the Junk folder etc.

Questions regarding the Mail Server
Dovecot, Exim, RoundCube
Post Reply
  • Print view
Advanced search
2 posts • Page 1 of 1
quatroweb
Posts: 31
Joined: Wed Aug 20, 2014 8:21 am

Removing mails from the Junk folder etc.
  • Quote

Post by quatroweb » Mon Jan 04, 2016 3:35 pm

I want to create this into the cron.daily on my vestacp ubuntu 14.04 server

I found this script which could help me out and looks good, but I can't figure out how to change the path to clean/ remove all mails from the Trash folder on each domain.

Code: Select all

#!/bin/sh
# Time to wait before removing mails from the Junk folder (Default: 7 days) Set 0 to turn off.
junk_max_hours=$((24*7))
# Time to wait before removing mails from the Trash folder (Default: 30 days) Set 0 to turn off.
trash_max_hours=$((24*60))
for domain in /var/vmail/*
do
  if [ -d "$domain" ]
  then
    for user in $domain/*
    do
      if [ "$junk_max_hours" -gt "0" ]
      then
        if [ -d "$user/.Junk" ]
        then
          tmpreaper -m $junk_max_hours $user/.Junk/cur
         tmpreaper -m $junk_max_hours $user/.Junk/new
        fi
      fi
      if [ "$trash_max_hours" -gt "0" ]
      then
        if [ -d "$user/.Trash" ]
        then
          tmpreaper -m $trash_max_hours $user/.Trash/cur
        tmpreaper -m $trash_max_hours $user/.Trash/new
        fi
      fi
    done
  fi
done
I guess I have to change the /var/vmail/ of cause, but to what? The exact path looks something like this: /home/$user/mail/$domain/$mailaccount/.Trash/cur/

Then there will be /new/ as well.
I want to use this script and run it automatically once per day as already mentioned.

Anyone could help me with the correct path?
Top

quatroweb
Posts: 31
Joined: Wed Aug 20, 2014 8:21 am

Re: Removing mails from the Junk folder etc.
  • Quote

Post by quatroweb » Sat Feb 13, 2016 1:11 pm

Anyone could guide me in the right direction with this issue?
Top


Post Reply
  • Print view

2 posts • Page 1 of 1

Return to “Mail Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password