Sieve updates

New ideas and constructive comments go here.

Moderator: Moderators

Locked
Drew
Posts: 3
Joined: Fri Sep 24, 2010 9:05 pm

Sieve updates

Post by Drew »

I took my first crack at implementing a RollerNet Sieve filter this evening. It's pretty powerful, but I hit a snag:

No support for the "variable" extension.

What I want to do is forward small messages (say, under 100K) to another mailbox for mobile use. For larger messages, I just want to send a notice that a large message arrived.

So far, so good.

However, without the variable extension, I don't see any way to include the subject of the large message, or the sender, or anything, in the notice. It's as generic as generic can be. (Unless I know all possible senders, or subjects, in advance and do this with a series of if statements.)

A second use which I'd seriously contemplate, if variables worked, is sending a text to myself (via the email-to-text address my wireless carrier provides) when I receive an email from a specific important origin. Then I could just send the subject, or maybe the first 140 characters of subject + body (if the variable extraction options permitted it).

And as a follow-up thought: If there is any information about which RFC describes the installed version of each RollerNet Sieve extension, it'd be great to have that (or a link to the RFC or other documentation) on the Sieve help page. Otherwise, it's trial and error to discover all the supported options for each extension.
Seth
Site Admin
Posts: 309
Joined: Sun Aug 30, 2009 10:44 pm
Location: Nevada
Contact:

Re: Sieve updates

Post by Seth »

Did you try "variable" or "variables" as the include? We use Dovecot Sieve.
Seth Mattinen, Roller Network LLC
Seth
Site Admin
Posts: 309
Joined: Sun Aug 30, 2009 10:44 pm
Location: Nevada
Contact:

Re: Sieve updates

Post by Seth »

I've updated the documentation page to include a link to the Dovecot wiki page and a copy of the extensions table.
Seth Mattinen, Roller Network LLC
Drew
Posts: 3
Joined: Fri Sep 24, 2010 9:05 pm

Re: Sieve updates

Post by Drew »

Ah, many thanks! The docs, and the knowledge that "variables" is supported, gets me almost all the way there.

The one snag I'm still hitting is the multi-line string syntax, as documented here:

http://tools.ietf.org/html/rfc5228#section-2.4.2

Part of the multi-line syntax involves a CRLF sequence. I'm using a Mac browser, and I wonder whether what's getting submitted through the Hosted Mail Box ManageSieve form is maybe just a linefeed, or just a carriage return, and therefore doesn't work? Have you been able to get the multi-line syntax to work through the form yourself, by any chance? Maybe from a Windows browser?
Seth
Site Admin
Posts: 309
Joined: Sun Aug 30, 2009 10:44 pm
Location: Nevada
Contact:

Re: Sieve updates

Post by Seth »

Drew wrote:http://tools.ietf.org/html/rfc5228#section-2.4.2

Part of the multi-line syntax involves a CRLF sequence. I'm using a Mac browser, and I wonder whether what's getting submitted through the Hosted Mail Box ManageSieve form is maybe just a linefeed, or just a carriage return, and therefore doesn't work? Have you been able to get the multi-line syntax to work through the form yourself, by any chance? Maybe from a Windows browser?
I haven't tried it personally. It is returning any errors or just uploading the wrong thing?
Seth Mattinen, Roller Network LLC
Drew
Posts: 3
Joined: Fri Sep 24, 2010 9:05 pm

Re: Sieve updates

Post by Drew »

I really should learn to stop trying to make things work at 11 pm on a Friday.

I tried it again this morning, and it's working fine. I must have inadvertently fouled up the syntax. Probably I used the token :text instead of text: or something similarly dumb.

Thanks again, and sorry for the false alarm!

For posterity, here's the basic script I ended up with, in case it helps anyone else. The goal, again, was to forward small, non-SPAM messages to a second mailbox for use on a mobile device, and to send a notice about large, non-SPAM messages.

Code: Select all

require ["enotify","copy","variables"];

if header :contains ["Subject"] "** SPAM:" {
  stop;
}

if size :over 10K {
  if header :matches ["Subject"] "*" {
    set "subject" "${1}";
  }
  if header :matches ["From"] "*" {
    set "from" "${1}";
  }

  set :encodeurl "body" text:
From: ${from}
Subject: ${subject}
.
;

  notify
    :importance "2"
    :message "Received large message (over 10K) at me@mail.com"
    "mailto:mobile-me@mail.com?body=${body}";
  stop;
}

redirect :copy "mobile-me@mail.com";
Seth
Site Admin
Posts: 309
Joined: Sun Aug 30, 2009 10:44 pm
Location: Nevada
Contact:

Re: Sieve updates

Post by Seth »

Great! Thanks for sharing a sample as well.
Seth Mattinen, Roller Network LLC
Locked