Mailclean perform some cleaning on the mail message directly at the server side,
using rules defined in a config file and/or passed as arguments.
Mailclean check each mail account as define in config file (or passed as argument).
Each time a rule or a group of rules is accomplished, mailclean ask to delete the
message (it is possible to force deleting).
Mailclean has the ability to speak if the system support the festival features.
Mailclean can manage statistics about the number of action for each account and for each rule,
mailclean also manage a log file to look at the stack of deleted messages.
Placing this software in a crontab can contribute to reduce amount of spam message.
mailclean [--options]
- --alias param
-
Add alias on user
- format :
-
--alias ``login sep aliastext'' Use `` to avoid shell interpretation.
- eg :
-
--alias ``bernard@mondan.org---bm@mondan.org''
- --check
-
Check config file. Config file is default config file or if --config fopt option is before --check,
fopt file will be check.
- --clear
-
Clear log file and stat file.
- --config f
-
f config file. Default config file is : $HOME/.mailclean/config
- --count param
-
Add a count to scan
- format :
-
--count ``popserv sep login sep password sep message''
- eg :
-
--count ``pop.free.fr---toto.truc---totopass---Toto mail box''
- --debug
-
Enable debug mode. In this mode there are many information displayed for
each message.
- --del
-
Add a new rule
- format :
-
--del ``rule=regexp sep rule=... sep ask=n''
-
rule must be one of sub, from, to, text or attach. The special key ask is
used to force no asking before delete.
-
regexp is a regular expression.
- eg :
-
--del ``sub=(viagra|cialis)---from=.+@hell.com''
-
mailclean use : /(viagra|cialis)/i as expression to check the subject field and /.+@hell.com/i
to check the sender. Note i for ignoring case.
In this case when the ask directive is not present, mailclean will ask before delete.
- --dlog
-
Display log file with 'less'
- --doc
-
Display the documentation.
- --dstat
-
Display stat file with 'less'
- --edit
-
Edit the configuration file with the default editor vi.
- --except
-
add a new exception rule.
- format :
-
--except ``rule=regexp sep rule=...''
-
rule must be one of sub, from, to, text or attach.
-
regexp is a regular expression.
- eg :
-
--except ``sub=software---from=.+@serious.com''
-
mailclean use : /software/i as expression to check the subject field and /.+@serious.com/i
to check the sender. Note i for ignoring case.
If the message yield these two rules, it will not be delete.
- --flog f
-
f log file
- --fstat f
-
f stat file
- -h, --help
-
Display help message
- --log
-
Enable log file when delete
- --maxline n
-
n max number of line read from head for each message.
- --maxlog sz
-
sz size max of log file before warning
- --sep xx
-
Modify the default separator. The new separator is xx. xx should be a regular expression.
- --speech
-
Add the speech functionality (need festival)
- --stat
-
Enable the statistics
- --verbose
-
Verbose mode
- --version
-
Display version
- Separator format
- ;;; or ,,, or +++ or --- or === or ___
- mailclean use $HOME/.mailclean/config as default config file.
It is possible to change this default file with the --config option.
- Mailclean use $HOME/.mailclean/log as default log file. It is possible to change this
default file with the --flog option.
- Mailclean use $HOME/.mailclean/stat as default stat file. It is possible to change this
default file with the --fstat option.
- The '#' character is for start comments up to end of line.
- count
-
is use to define a mailing account to check.
- format :
-
count <TAB> pop server <TAB> user login <TAB> password <TAB> text spelled
- def
-
to define a variable for use in a rule. Variable use in a rule must be define before using it.
- format :
-
def <TAB> myvar=regexp
-
myvar is define as a variriale that is egal to regexp (regular expression).
- eg :
-
def <TAB> badsub=(cialis|viagra)
-
To use the variable badsub in a rule definition you have to put the $ character before the name
of the variable as in $badsub.
- del
-
to define rule for deleting a mail
-
There are 4 rules : sub, from, to, attach or text. For each rule mailclean use a different field in the header
of the mail. It is possible to make AND between two or up to four rules.
It is also possible to force deletion with the special key ask.
-
del <TAB> sub=string <TAB> ask=n
-
to delete with no confirmation all messages matching string in subject part.
-
del <TAB> sub=str1 <TAB> from=str2
-
to delete message matching str1 in the subject field and matching str2 in From field.
-
del <TAB> attach <TAB> ask=y <TAB> string
-
to delete with confirmation messages that match string in the part name of attachment
or in the part Attached of the message
-
It is strongly recommended to use regular expression for string.
- alias
-
is use to select the valid message for Delivered-to field.
- format :
-
alias <TAB> user login <TAB> autorised alias
-
Sometime provider redirect to one single account when the domaine name is ok but
the user name is not.
This commande permit to select autorised alias as user login for an account.
All mail with other user account will be delete without confirmation.
- except
-
is used to add exception to rule. Each exception field matching these rule will not be delete.
-
There are 4 exception : sub, from, to, attach or text. For each exception mailclean use a different field in the header
of the mail. It is possible to make AND between two or up to four exception.
-
except <TAB> sub=string
-
to avoid delete message matching string in subject part.
-
except <TAB> sub=str1 <TAB> from=str2
-
to avoid delete message matching str1 in the subject field
and matching str2 in from field.
-
except <TAB> attach <TAB> string
-
to avoid delete message that match string in the
part name of attachment or in the part Attached of the message
- maxlog
-
is used to adjust the max size of the log file before a warn message. When you got
the warn message, you have to remove the log file to start a new session of recording.
- format :
-
maxlog <TAB> sz : sz size max before warning
- maxline
-
is used to adjust the max number of line read for each message. When mailclean
encouter the Content-Type string in the header of the message, it start a counter that is equal
to maxline/4, and then it stop reading the message after this number of line.
- format :
-
maxline <TAB> n : n number max of line to be read by message
- log 0 or 1
-
This enable (1) or disable (0) the log capability.
- flog file
-
file is used as log file. In this case the log flag is set to 1
- stat 0 or 1
-
This enable (1) or disable (0) the stat capability.
- fstat file
-
file is used as statistics file. In this case the stat flag is set to 1
Bernard MONDAN : bernard@mondan.org
This file is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
Copyright 2005 Bernard MONDAN