Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 18th February 2013, 04:57
0riole 0riole is offline
Junior Member
 
Join Date: Nov 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rule to delete old email and auto import into blacklist

Hi All,

I'm looking for a way to set a rule in ISPConfig 3 or Postfix to delete old emails from the server, say any email older then say 14 days. Also would like one to collect email addresses from Junk folders and add them to blacklists. BTW I'm using CentOS 6.3

TIA
Chris

Last edited by 0riole; 18th February 2013 at 05:12.
Reply With Quote
Sponsored Links
  #2  
Old 18th February 2013, 10:33
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,015
Thanks: 840
Thanked 5,651 Times in 4,461 Posts
Default

Neither postfix nor ispconfig has such a function builtin.

You will have to write script that goes trogh all email folders in /var/vmail to remove the olr mails and forward spam mails to spamassassin, e.g. as a cronjob.

Seee e.g. here for a script that removes old mails from maildir:

http://www.ducea.com/2006/11/25/clea...ete-old-mails/
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 20th February 2013, 00:36
Turbanator Turbanator is offline
Senior Member
 
Join Date: Jun 2008
Posts: 220
Thanks: 23
Thanked 16 Times in 16 Posts
 
Default

Here is a simple script I use. I think I may have pulled it form here years ago.
Code:
#!/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*30))
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,new}
        fi
      fi
      if [ "$trash_max_hours" -gt "0" ]
      then
        if [ -d "$user/.Trash" ]
        then
          tmpreaper -m $trash_max_hours $user/.Trash/{cur,new}
        fi
      fi
    done
  fi
done
For spamassassin learning

Code:
#!/bin/sh
/usr/bin/sa-learn --spam /var/vmail/(domain)/.Junk/*/*

Last edited by Turbanator; 20th February 2013 at 00:40.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
auto delete spam/junk webmail folder Turbanator Programming/Scripts 3 5th October 2010 03:00
email auto reply dynaguy Server Operation 2 13th August 2010 21:03
Email auto response perfectpol7 Server Operation 2 3rd April 2010 12:34
Email Auto Config collimic Installation/Configuration 1 28th February 2009 15:47
Email auto register blackmask Installation/Configuration 1 13th December 2007 18:53


All times are GMT +2. The time now is 20:32.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.