[Top] [All Lists]

Re: extensions and sieve

2003-02-03 14:45:43

In addition to what Nigel Swinson <Nigel(_at_)Swinson(_dot_)com> wrote:

Anyone could help me? I need filter mails by extensions (.exe .vbs ....).
How i can do a rule to this?

The Sieve spec doesn't natively support any kind of test on the content of
the message, only the headers, envelope and size of the message.  Sieve is
currently not MIME aware at all.

However some implementation have some kind of X_body test that allows you to
search against the body of the message, but it's all a bit of kludge.  It's
only really worthwhile if it's available in conjunction with the regex
extension, and even then it becomes extremely CPU intensive, and a problem
for the server.

The better solution is to wait for us to knock together some kind of mime
aware syntax that allows us to say "emails that contain attachments of type

In the meantime, note that for a message that is in MIME format, you can hope
that perhaps the filename will show up in a MIME header line.  For instance,
filenames are sometimes in a NAME parameter on a Content-type: header line, or
in a FILENAME parameter on the Content-disposition: header line, or
occasionally filenames will even get put on the Content-description: header
line.  So you could try doing something like:

if header :contains
 ["Content-type", "Content-disposition", "Content-description"] ".vbs" { 
 ...some action... }

but of course note that that's only going to apply in cases where incoming
messages are in MIME format, and happen to have the filename explicitly
advertised on one of the listed MIME header lines.  So depending upon what
sorts of incoming messages you're dealing with, this may or may not be useful.



Doing this with MailSite for example, involves following the advice found in
the following KB articles:

The KB articles describe how to enter the filters into the gui, but if you
click the "advanced" button then you get to see the Sieve it produces in all
it's glory.

BTW, this list is NOT designed to answer this kind of query... it's for
discussion and creation of new Sieve standards/specs.  Advice on this kind
of thing should be solicited from your mail server provider.



<Prev in Thread] Current Thread [Next in Thread>