[Top] [All Lists]

Re: dynamic naming & creation of mailboxes

2002-12-16 16:19:31

[Andrew Hammond]:

  I'm looking to create a new sub-folder / day setup for an mailbox
  that gets a couple of hundred messages every day.  Then
  automatically deliver messages to today's folder.
  I've checked the mailing list archives, googled, and read the
  Sieve RFC.  It looks to me like there's now way to do this easily
  with Sieve.

I'm currently writing a draft for an extension allowing expansion
inside strings.  the main motivation for it is to allow access to back
references in regular expressions.  with that in place (I hope to hack
an implementation during Christmas :-), you could do

  require ["fileinto", "regex", "stringexpand"];

  if header :regex ["date"] ", ([0-3]?[0-9]) ([A-Z][a-z]{2}) ([0-9]{4})" {
        let "year"  "${3}";
        let "month" "${2}";
        let "day"   "${1}";
        fileinto "INBOX.${year}-${month}-${day}";

this is a bit awkward, though, and you are not guaranteed that the
Date header will comply with RFC 2822 grammar.  (most of the bogus
Date headers would probably be found in spam messages, though.)

perhaps the extension should include built-in variable names for time
of day.  hmm.

BTW, my extension really is three things in one:

  string expansion  (changes the semantics of doublequoted strings)
  variable setting  ("let" keyword)
  new test "string" (e.g., if string :regex "${year}" "2..." { ...})

should this be split into two or three different extensions?  what do
you guys think?

  My current solution is a perl script run by a cron job that makes
  the sub-folder and writes a new .sieve.
  Is there a better way to do this?

hopefully, there will be.

Kjetil T.                       |  read and make up your own mind

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