Pegasus Mail & Mercury

Welcome to the Community for Pegasus Mail and
The Mercury Mail Transport System, the Internet's longest-serving PC e-mail system!
Welcome to Pegasus Mail & Mercury Sign in | Join | Help
Home Blogs Forums Downloads Pegasus Mail Overview Mercury Overview Wiki

Mail filtering add on

  •  09-13-2018, 12:26

    • Tym is not online. Last active: 15 Nov 2018, 18:07 Tym
    • Top 500 Contributor
    • Joined on 09-13-2018
    • Preston, UK
    • Member
    • Points 200

    Mail filtering add on

    Hi peeps,

     After a long time of using an Excuse of a mail server, I've reverted to Mercury, and it feels good to be back! Running 4.80 as a service (bought license)...

    The only "problem" I have, like most people I suppose, is that of spam.  I've got Spamhalter ticked, configured MercuryS to use Spamhaus, abuseat, spamcop etc and also added transaction filters for certain words in the MercuryS exceptions.

    It's probably me not setting things up correctly, but these don't seem to cut the mustard.

    So... I've written a little program that does what I need and it is triggered as a Policy on each mail that comes in.

     We have a filter.rules file which specifies words to test each line for and the weight achieved when *all* are matched. For example, this is a simple rules file:

    #weight, list of words separated by commas

    100,subject:,flight,simulator

    -1000,from:,@mydomain.com

     *All* of the words have to appear for the weighting to be applied, so if "flight" and "simulator" are in the body, and not the subject, this won't trigger. Similarly if it is sent from @mydomain.com the weighting is reduced so the rule doesn't trigger

    This program allows other lines within the email text to be tested not just the ones provided for in the transaction filter.

    It is used like this:

    Create a new policy

     Type of task is "Run a program and examine the return code"

    Command line is

    mercuryfilter ~A TotalWeight AppendLog

      for example:

    mercuryfilter ~A 100 true

    This will  cause the program to trigger a policy failure if the total weighting of the all the rule triggers is equal to or greater than 100. It also creates a log file which can either be replaced by each new email or appended by each one. If you want to keep a log of all the emails passed through, set the AppendLog flag to true. There's a different log file for each day.

    I also have step 4 set to forward the emails that fail to me, just so I can check... 

     If you want to have a try, it can be downloaded at http://www.ictis.net./downloads/MercuryFiltersInstaller.msi

     Use with caution - no warranty is provided or implied! :-) It seems to do what I need it to here...

     The program installs to the c:\mercury by default and needs DotNet 4.5.2 to be installed.

     Hopefully I've not reinvented the wheel, but I'd appreciate any comments - especially if it's useful to someone else!

     

    Tym

     


    Tym
    Filed under: ,
View Complete Thread

Contact | Advertise | Host provider: PraktIT | Terms of Use | Privacy Statement
Copyright © 2007-2011 David Harris / Peter Strömblad. | Pegasus Mail Home Page