"Clean_Mail" for Unix









The 2.03 version has been available on www.linuxberg.com on sunday march 7.


On thursday march the 11, i have added a STAT_USER variable. With it, it is possible to choose how the program check the user in the passwd file.

STAT_USER by_uid In this case the program take the uid of the mail file and compare with the third field of the passwd file.

STAT_USER by_login In this case the program take the name of the mail file (most often the login) and compare with the first field of the passwd file.


On thusrday march the 11, i also add a SAVE_MAIL_NOT_IN_PASS variable. With it you can save the mails files of users no longer in passwd file.

SAVE_MAIL_NOT_IN_PASS 0 The mail files of users that are no longer in passwd file are deleted.

SAVE_MAIL_NOT_IN_PASS 1 The mail files of users that are no longer in passwd file are saved in the same place that deleted mails with a name like: user_not_in_passwd.sauve They are saved in the same .tar.gz that deleted mails if SAVE is at 1. Tu put SAVE_MAIL_NOT_IN_PASS at 1, SAVE_PATH must be set.


On monday april the 12 i added a variable. The YEAR variable is the number of the current year on the date line. You must type "date" and look for the year at the end of the line. You must count the "words" separate by spaces from 0
Example: I type "date", enter and i get this line:
lun avr 12 20:02:15 CEST 1999
In this case the YEAR variable will be set at 5 (the fifth field from 0).



On wednesday april the 14 i have removed the VERSION_FRANCAISE variable. Now the program can automaticaly recognize the french accent.


If the program is out of memory with a very big mail file, this one will not be erased like in the 2.03 and the first time of 2.04 version.


On saturday april the 17

Here are the differents sort of date lines that are supported in this software. If you find other types, please send it.

Date: Tuesday, October 27, 1998 12:48 AM
Date: vendredi 11 septembre 1998 17:12
Date: 99-02-15 06:18:26 EST
Date: 25 February 1999 03:42
Date: 23/03/99
Date: 19 Apr 1999 11:09:21 +0200
Date: 01/11/99 11:37:00 AM Pacific Daylight Time
Date: Wed, 14 Oct 1998 22:19:39 +0200


2.07 version. On thusday may the 11: Now at the end of the files treatment the program inform the users, giving him the name of the mail files not treated when there is not enough memory.
2.07 version. On saturday 1999 june 26, i have added protections against incoherent variable in clean_mail.conf.
2.08 version. The Monday 9 August, I found and corrected a minor bug that signalled 0 bytes mail files, as not having been processed because of lack of memory.
2.08 version. The tuesday 10 August, i found and corrected a bug for the french users. The august month in french (aoŻ), was not recognize in a mail file because it was written "auŻ" in lieu of "aoŻ" in the software.
2.08 version. Now in the Date: lines of standard mail files or in the current date of systems, the months written in french, german, italian and spanish are supported.
2.08 version. The 08/12/99, i added a variable that permit to exclude some files from process. (useful, if thy are not too much, see "set Clean_Mail")
2.09 version. The 08/15/99. Inversely, it is also possible to indicate to the soft a list of mail files to process exclusively (useful if the files which must not be processed are too many, see "set Clean_mail"). The two functions can be used simultaneously.
2.10 correction of documentation
2.20 version. The 08/31/99 i have added a new variable for processing only the mail files that are in passwd.
Now Clean_Mail indicate at the end of the process and in a file in the backup, the space took by the mail files before and after the process. If your "du" command does not know "-h" (human readable man du) remove "-h" from "du -h" in effacement_fichiers_vides and clean_mail sh scripts.
2.21 version the 09/02/99. Possibility for Clean_mail to send automatic mails to users when old mail is deleted.
2.30 version the 09/14/99. Before 2.30 version Clean_Mail was scanning the mail files in one time, so in some cases whith low memory servers, some very big mail files was not processed.

Now, Clean_Mail scans the mail one by one, so even with low memory and huge mail files, every files will be processed.


2.31 version. Little bugs correction.
2.32 version. I made little changes in "chown" command for a user who have dot in passwd login.
2.33 version. I added a protection to avoid mail lost when new mail is sent exactly when Clean_Mail process the mail files.
2.34 version. Add of protection in the way of pick up a mail.
2.35 version. Little bugs correction.
2.40 version. Add of an anti_spam mode.
2.41 version. Better anti-spam.
2.42 version. Bugs correction.
2.43 version. The anti-spam mode of 2.42 was looking only for the spammer's email of the From line (and optionnaly the subject line) but there was still the obligation to put the complete from line in the clean_mail.conf. So now for the anti-spam mode you have just to put spammer's email and optionnaly (but recommended) the subject line.
2.44 version. I have added a chmod 000 just before a mv on each mail file and chmod 600 just after to avoid that Sendmail write a new mail just a few milliseconds before this mv.
2.45 version. I moved the chmod 000 just when Clean_Mail read the end of file, it's a better protection.
2.47 version. I added an ultimate protection in relation with chmod 000. At the end of a file before the chmod 000 Clean_Mail read the file size and read it again before the "mv". If the sizes are not similar, i do not make the "mv" and i write at the screen and in a file named unprocessed_file.save of the .tar.gz backup the accounts not processed.
 2.50 version. The protection that read file size is now optionnal. If it is actived, it reads the first time the file _size before the process begin and the second time before the move. The chmod 000 protection is still available after Clean_mail reached the end of file.
2.51 version. Just a minor bug correction. In the %mois1 hashtable there was '" sep"' instead of '"sep"'.
2.52 version. A user asked me a new feature for anti-spam mode. Now With the ONLY_DOMAIN variable the program takes only the right part (domain) of the spammer email (@spammer.com). Then the program can process several spam with email like: cindy1234@spammer.com cindy1235@spammer.com, etc ... see the clean_mail.conf
2.53 version. A user asked me for a new feature for anti-spam mode. Now with the ONLY_LINE_SPAM variable the program can take only a line shared by all spam to erase it. It is useful when a spam is disguised in several domain and emails. See the clean_mail.conf
May 2000. 2.54 version. It is now possible to put several "Subject: line" in the clean_mail.conf to erase in one time several viruses like "ILOVEYOU".
June 2000. Correction of a bug with anti-spam.
October 2000. A user ask me for the subject lines of the deleted mails, in the users mail.
May 2001. A user ask me for Portuguese support, and for mail of 1995 which was not deleted. Now all mails older than 9 years are not deleted. All mails in the future (if the sytem is misconfigured) are still not deleted. If you want to delete mail older than 9 years, go in the file rm_mails.pl at the line 999 and put 1 in the line "$efface = 0".
March 2002. I've added a lock file (/tmp/clean_mail.lock) to avoid that users run several session of Clean_Mail. I've added also "use strict" in all the Perl scripts.
July 2003. 2.60 version. A little bug has been corrected in the anti-spam mode. The program could not manage the email and the spam lines in the same time.