mailfilter-old
10 years agoFix function name. master
Frédéric Jolliton [Fri, 3 Jul 2009 09:18:31 +0000 (11:18 +0200)]
Fix function name.

10 years agoAdd a new action `script'.
Frédéric Jolliton [Thu, 2 Jul 2009 21:25:30 +0000 (23:25 +0200)]
Add a new action `script'.

This action can be used to let an external script process the incoming
mail. For example, it can be used to automatically extract pictures
from a mail matching certain criterions and add the pictures to a website.

The script must take the 1 argument: the username. The mail itself
is sent on the standard input. The script (or program) must store it
on the filesystem if elaborate processing is needed.

It is IMPORTANT for the script to do not block the filter too long!

10 years agosyntax: Remove superfluous spaces.
Frédéric Jolliton [Thu, 25 Jun 2009 08:51:38 +0000 (10:51 +0200)]
syntax: Remove superfluous spaces.

Drop all superfluous spaces which can be more annoying than useful.

10 years agoUpdate for new confparser
Bernt Hansen [Thu, 26 Feb 2009 21:22:41 +0000 (16:22 -0500)]
Update for new confparser

10 years agoSocket send expects integer parameters
Bernt Hansen [Thu, 26 Feb 2009 21:22:21 +0000 (16:22 -0500)]
Socket send expects integer parameters

13 years agoUpdated configuration reader.
Frédéric Jolliton [Tue, 28 Nov 2006 12:26:17 +0000 (13:26 +0100)]
Updated configuration reader.

readConfiguration now returns a class instance with
attributes for each options, instead of returning a
dictionnary.

13 years agoFix some() argument.
Frédéric Jolliton [Mon, 27 Nov 2006 14:18:23 +0000 (15:18 +0100)]
Fix some() argument.

13 years agoSeveral minor changes.
Frédéric Jolliton [Mon, 27 Nov 2006 14:18:01 +0000 (15:18 +0100)]
Several minor changes.

13 years agoRenamed --check-config to --check-rules.
Frédéric Jolliton [Mon, 27 Nov 2006 13:40:41 +0000 (14:40 +0100)]
Renamed --check-config to --check-rules.

13 years agoSimplification of the logging part.
Frédéric Jolliton [Mon, 27 Nov 2006 13:39:36 +0000 (14:39 +0100)]
Simplification of the logging part.

13 years agoSmall changes to validconf.
Frédéric Jolliton [Mon, 27 Nov 2006 13:34:07 +0000 (14:34 +0100)]
Small changes to validconf.

13 years agoDo not catch KeyboardInterrupt in process()
Frédéric Jolliton [Mon, 27 Nov 2006 11:33:46 +0000 (12:33 +0100)]
Do not catch KeyboardInterrupt in process()

13 years agoBetter LogMessage class.
Frédéric Jolliton [Sun, 26 Nov 2006 16:12:41 +0000 (17:12 +0100)]
Better LogMessage class.

13 years agoRemoved extra blank lines. Normalized docstrings.
Frédéric Jolliton [Sun, 26 Nov 2006 16:07:11 +0000 (17:07 +0100)]
Removed extra blank lines. Normalized docstrings.

13 years agoUpdated configuration file example for correctness (not quote for cyrus_adm needed) v0.1.4
Frédéric Jolliton [Sat, 24 Jun 2006 18:44:16 +0000 (20:44 +0200)]
Updated configuration file example for correctness (not quote for cyrus_adm needed)

13 years agominor update: reformated the README file
Frédéric Jolliton [Sat, 24 Jun 2006 18:34:57 +0000 (20:34 +0200)]
minor update: reformated the README file

13 years agoNew feature: mailbox auto-creation (disabled by default)
Frédéric Jolliton [Sat, 24 Jun 2006 16:02:47 +0000 (18:02 +0200)]
New feature: mailbox auto-creation (disabled by default)

13 years agountabified
Frédéric Jolliton [Sat, 24 Jun 2006 15:47:54 +0000 (17:47 +0200)]
untabified

13 years agoAdded mailfilter.conf.sample
Frédéric Jolliton [Sat, 24 Jun 2006 15:40:10 +0000 (17:40 +0200)]
Added mailfilter.conf.sample

13 years agoMissing mailfilter_conf.py in MANIFEST
Frédéric Jolliton [Wed, 12 Apr 2006 15:40:36 +0000 (17:40 +0200)]
Missing mailfilter_conf.py in MANIFEST

13 years agoSwitched to distutils.
Frédéric Jolliton [Wed, 12 Apr 2006 15:11:39 +0000 (17:11 +0200)]
Switched to distutils.

Configuration file is now at /etc/mailfilter.conf and is parsed with
ConfigParser standard Python module.

The documentation point at the git repository now.

14 years agoConverted source to utf-8. Fixed clamdscan output parsing. frederic@jolliton.com--2005-private,mail-filter--main--0.1.3
Frederic Jolliton [Mon, 27 Jun 2005 19:40:33 +0000 (19:40 +0000)]
Converted source to utf-8. Fixed clamdscan output parsing.

* Converted source code to utf-8.

* Fixed clamdscan to parse both stdout and stderr (because
  clamdscan recently changed to output to stdout instead of
  stderr !)

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-15

14 years agoFixed ensureDirectoriesExist() by importing errno module !
Frederic Jolliton [Fri, 13 May 2005 04:59:30 +0000 (04:59 +0000)]
Fixed ensureDirectoriesExist() by importing errno module !

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-14

14 years agoTypo.
Frederic Jolliton [Fri, 13 May 2005 02:29:03 +0000 (02:29 +0000)]
Typo.

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-13

14 years agoAdded configuration variable to set default action when trying to deliver to an unkow...
Frederic Jolliton [Fri, 13 May 2005 02:08:56 +0000 (02:08 +0000)]
Added configuration variable to set default action when trying to deliver to an unkown user.

* Added g_unknownUserAction to specify what to do when
  we try to deliver a mail to an unknown user.
git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-12

14 years agoAdded a module to contains configuration variable. Code cleaning & style stuff updated.
Frederic Jolliton [Fri, 13 May 2005 01:42:10 +0000 (01:42 +0000)]
Added a module to contains configuration variable. Code cleaning & style stuff updated.

* Python version is tested prior to running the script.

* Deprecation warnings are disabled (especially to disable
  the 'strict' keyword usage in message_from_string.)

* Moved configuration variable to module mailfilter_conf.py
  (but packaging example file as mailfilter_conf-sample.py.)
  Installation script updated accordingly.

* Moved part of the code from testRule to a new function
  extractHeaderAddresses.

* Various cleaning stuff (one return per function, correct None
  equality test, parenthesis around boolean expression,
  string comment in functions,..)

* Minor update to documentation.
git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-11

14 years agoCheck for nul character in mail contents for broken test. If delivering broken mail...
Frederic Jolliton [Sat, 19 Mar 2005 14:21:26 +0000 (14:21 +0000)]
Check for nul character in mail contents for broken test. If delivering broken mail as attachment fail, then try to deliver it as inline.

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-10

14 years agoEncapsulate broken mail as attachment instead of inserting raw contents.
Frederic Jolliton [Sat, 19 Mar 2005 12:50:42 +0000 (12:50 +0000)]
Encapsulate broken mail as attachment instead of inserting raw contents.

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-9

14 years agoOOPS. Big typo.
Frederic Jolliton [Fri, 18 Mar 2005 01:12:05 +0000 (01:12 +0000)]
OOPS. Big typo.

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-8

14 years agoHandle broken (rejected by cyrus) mails. Rewrote logMessage stuff.
Frederic Jolliton [Fri, 18 Mar 2005 00:52:12 +0000 (00:52 +0000)]
Handle broken (rejected by cyrus) mails. Rewrote logMessage stuff.

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-7

14 years agoMinor update in documentation.
Frederic Jolliton [Sun, 13 Mar 2005 12:58:53 +0000 (12:58 +0000)]
Minor update in documentation.

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-6

14 years agoAdded support to compress mail in recovery directory.
Frederic Jolliton [Sun, 13 Mar 2005 12:55:24 +0000 (12:55 +0000)]
Added support to compress mail in recovery directory.

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-5

14 years agoReturn TEMPFAIL is custom error code is invalid. Added DISCARD custom error code...
Frederic Jolliton [Wed, 9 Mar 2005 17:18:22 +0000 (17:18 +0000)]
Return TEMPFAIL is custom error code is invalid. Added DISCARD custom error code to discard mail without returning error.

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-4

14 years agoBig bug fixed: Correctly return custom error code to sendmail !
Frederic Jolliton [Wed, 9 Mar 2005 16:16:57 +0000 (16:16 +0000)]
Big bug fixed: Correctly return custom error code to sendmail !

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-3

14 years agoUpdated module list to install (!). Byte-compiling installed modules.
Frederic Jolliton [Wed, 9 Mar 2005 13:21:25 +0000 (13:21 +0000)]
Updated module list to install (!). Byte-compiling installed modules.

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-2

14 years agoUpdated to use confparser from tuxeenet modules.
Frederic Jolliton [Wed, 9 Mar 2005 13:10:04 +0000 (13:10 +0000)]
Updated to use confparser from tuxeenet modules.

git-archimport-id: frederic@jolliton.com--2005-private/mail-filter--main--0.1.3--patch-1

14 years agoSealing. frederic@jolliton.com--2005-private,mail-filter--main--0.1.3--base-0
Frederic Jolliton [Wed, 9 Mar 2005 11:31:41 +0000 (11:31 +0000)]
Sealing.

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.2--version-0

14 years agoUpdated TODO list.
Frederic Jolliton [Wed, 9 Mar 2005 11:28:45 +0000 (11:28 +0000)]
Updated TODO list.

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.2--patch-9

14 years agoUpdated to return NOUSER error code if user doesn't exist in Cyrus.
Frederic Jolliton [Wed, 9 Mar 2005 11:28:03 +0000 (11:28 +0000)]
Updated to return NOUSER error code if user doesn't exist in Cyrus.

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.2--patch-8

15 years agoTypo fixes in README and install.sh
Frederic Jolliton [Wed, 5 Jan 2005 20:03:47 +0000 (20:03 +0000)]
Typo fixes in README and install.sh

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.2--patch-7

15 years agoIn broken test, consider header with unknown charset as valid.
Frederic Jolliton [Sun, 21 Nov 2004 12:47:02 +0000 (12:47 +0000)]
In broken test, consider header with unknown charset as valid.

* In isMailBroken, we consider header with unknown charset as valid.
  This is because, Python may don't know some encoding and we don't
  want the script to tag the mail as broken is this case.

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.2--patch-6

15 years agoBetter log message for broken headers.
Frederic Jolliton [Fri, 19 Nov 2004 09:26:57 +0000 (09:26 +0000)]
Better log message for broken headers.

* Output for broken headers changed to log at most
  a predefined quantity of header, and to remove the ''
  around the names.
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.2--patch-5

15 years agoBroken test now check if headers are correctly encoded.
Frederic Jolliton [Fri, 19 Nov 2004 09:08:25 +0000 (09:08 +0000)]
Broken test now check if headers are correctly encoded.

* 'broken' test, in addition to testing that the mail was
  correctly parsed by email python module, now also test
  that every header can be decoded correctly (that mean
  that for example, a subject header with 8 bits contents
  will be marked as broken.)
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.2--patch-4

15 years agoFix exception in virus scan.
Frederic Jolliton [Thu, 18 Nov 2004 05:19:28 +0000 (05:19 +0000)]
Fix exception in virus scan.

* IMPORTANT: We catch exception derived from Exception, but antivirusScan was
  throwing a string exception. That caused global try/catch to miss that, and
  let sendmail believe than the mail was correctly delivered.

* confparser.readConfiguration now return None if rule file doesn't exist.

* Removed log for absence of rule (either because the user file doesn't exist,
  or because no rule are defined inside it.)
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.2--patch-3

15 years agoAdded support to test if a particular header is present or not.
Frederic Jolliton [Wed, 17 Nov 2004 14:19:55 +0000 (14:19 +0000)]
Added support to test if a particular header is present or not.

* The 'present' match was added to test if a header is present
  in mail or not.

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.2--patch-2

15 years agoFixed parser for one letter keyword.
Frederic Jolliton [Wed, 17 Nov 2004 14:16:44 +0000 (14:16 +0000)]
Fixed parser for one letter keyword.

* Fixed regex in confparser.py. Otherwise, keyword
  with only one letter were not recognized.

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.2--patch-1

15 years agoSealing. frederic@jolliton.com--2004-private,mail-filter--main--0.1.2--base-0
Frederic Jolliton [Sun, 14 Nov 2004 20:55:41 +0000 (20:55 +0000)]
Sealing.

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.1--version-0

15 years agoUpdated the CREATING-RULES file.
Frederic Jolliton [Thu, 11 Nov 2004 16:42:33 +0000 (16:42 +0000)]
Updated the CREATING-RULES file.

* Added a short explanation about partial match in headers.
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.1--patch-6

15 years agoFixed bug in message about custom error code.
Frederic Jolliton [Thu, 11 Nov 2004 15:01:53 +0000 (15:01 +0000)]
Fixed bug in message about custom error code.

* Fixed the bug when generating the log for the case were we
  return a custom error code.
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.1--patch-5

15 years agoAdded '.user' partial match.
Frederic Jolliton [Thu, 11 Nov 2004 14:46:59 +0000 (14:46 +0000)]
Added '.user' partial match.

* Added '.user' partial match, to match against
  the part before the @ in email address.
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.1--patch-4

15 years ago'all' match added. Better header parsing. Behavior of test mode change.
Frederic Jolliton [Thu, 11 Nov 2004 14:33:01 +0000 (14:33 +0000)]
'all' match added. Better header parsing. Behavior of test mode change.

* Added 'all' match. It's always matching any mail.
  It allow catchall rule.
* Better header parsing. Headers were not normalized for blank
  when using a partial match (.domain/.address/.name). Part
  name '.raw' added ('from.raw' is equivalent to 'from'.)
* Test mode behavior changed. Now, it list summary of matching
  rules.
* Fixed a bug on the output when checking a configuration (with -c).
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.1--patch-3

15 years agoAdded --version option. Added install.sh.
Frederic Jolliton [Thu, 11 Nov 2004 12:26:54 +0000 (12:26 +0000)]
Added --version option. Added install.sh.

* Added --version option.
* Added install.sh to install mail.filter.
* Makefile now just call install.sh for rule 'install'
  (and copying mailfilter.py was missing from the previous Makefile.)
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.1--patch-2

15 years agoEnhanced matches for headers. Better header parsing.
Frederic Jolliton [Thu, 11 Nov 2004 11:33:20 +0000 (11:33 +0000)]
Enhanced matches for headers. Better header parsing.

* Enhanced matches for headers by adding the following
  support for the suffixes .name, .address and .domain
  to header name (e.g 'From.domain' to match domain part.)
* Better header parsing, by using email.Header.decode_header
  and building a unicode string from the value returned.
  (i.e to support for example '=?iso-8859-1?q?...'.)
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1.1--patch-1

15 years agoSealing. frederic@jolliton.com--2004-private,mail-filter--main--0.1.1--base-0
Frederic Jolliton [Mon, 1 Nov 2004 02:29:07 +0000 (02:29 +0000)]
Sealing.

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1--version-0

15 years agoImportant bug preventing the use of rules.
Frederic Jolliton [Mon, 1 Nov 2004 01:45:59 +0000 (01:45 +0000)]
Important bug preventing the use of rules.

* 'return conf' was missing from readConfiguration !
* Path to Cyrus deliver binary changed to reflect
  the location on this command on Gentoo system with
  Cyrus 2.2.
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1--patch-8

15 years agoAdded --disable-backup option.
Frederic Jolliton [Mon, 1 Nov 2004 01:19:06 +0000 (01:19 +0000)]
Added --disable-backup option.

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1--patch-7

15 years agoBugfix related to exception in process()
Frederic Jolliton [Mon, 1 Nov 2004 00:56:43 +0000 (00:56 +0000)]
Bugfix related to exception in process()

* The try/except was catching SystemExit exception, which what
  wrong.
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1--patch-6

15 years agoAdded a Makefile with clean/install
Frederic Jolliton [Sun, 31 Oct 2004 04:38:57 +0000 (04:38 +0000)]
Added a Makefile with clean/install

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1--patch-5

15 years agoAdded a README and CREATING-RULES file
Frederic Jolliton [Sun, 31 Oct 2004 04:26:47 +0000 (04:26 +0000)]
Added a README and CREATING-RULES file

* Added a README file with installation instruction
* Added a CREATING-RULES file with instruction to
  create rules configuration file.
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1--patch-4

15 years agoChanges related to logs and error handling.
Frederic Jolliton [Sat, 30 Oct 2004 22:53:29 +0000 (22:53 +0000)]
Changes related to logs and error handling.

git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1--patch-3

15 years agoMajor changes for reading/parsing/validating configuration files.
Frederic Jolliton [Sat, 30 Oct 2004 22:25:21 +0000 (22:25 +0000)]
Major changes for reading/parsing/validating configuration files.

* Split validator into 2 parts:
  - basicvalidator, for the core part,
  - confparser, mail.filter specific part.
* Split parser into 2 parts:
  - basicparser, for the core part,
  - confparser, mail.filter specific part.
* confparser now cache parser result for faster processing.
* And some minor changes and bugfixes.
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1--patch-2

15 years agoLot of untested changes.
Frederic Jolliton [Fri, 29 Oct 2004 21:39:33 +0000 (21:39 +0000)]
Lot of untested changes.

* Many changes.
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1--patch-1

15 years agoInitital import of mail-filter frederic@jolliton.com--2004-private,mail-filter--main--0.1--base-0
Frederic Jolliton [Thu, 28 Oct 2004 06:55:48 +0000 (06:55 +0000)]
Initital import of mail-filter

This is the inital import of mail-filter project. At this
point the filter should not be used in production !
git-archimport-id: frederic@jolliton.com--2004-private/mail-filter--main--0.1--base-0