[Dovecot] Fwd: Sieve script problem (don't know if is it possible to do this)
Ok, let simplify a little bit the problem: Forget about outgoing or incoming mail. Forget about IMAP or SMTP. You have a ton of emails in raw form (RFC-XXX, don’t remember the exact number right now) you want to classify… and you think: “Sieve is a language made to do exactly that kind of task… If only I could use the same mechanism dovecot-lda uses! Oh, wait… “sieve-test –e” does exactly that!!! I could use it!!!”… but so far… no success.
Now, a little more context. I want to leave a copy (a historical record) of every email (work related) I received/sent. The processing/classification doesn’t have to be in real time, it can be on “down time/offline/later/scheduled”. Sent messages are hard, because of the several senders and the several copies on several folders. But I can work around it, with various tricks (bcc, different headers, etc.) and adjusting the processing sieve script. I can train myself –The interest is mine after all!-, and that’s OK. But I can’t train other people to suit my needs. And received messages are JUST AS HARD. Because I want to classify them using the same rules. I also want to keep context, to record all things work related, not only what I said, but also what was said by others, using the same rules (which by the way, are many more than the restricted example I posted). Besides, I want the PC do all the work for me, not the other way around. I think “Sieve must be capable of doing it! This is the kind of things sieve was designed for!” is a reasonable idea. But so far, no success… :-(
Now, let me see all the replies in detail... (I really appreciate all the help I'm getting, thank you all very much)
Yanko
On 11/15/13, Stephan Bosch <stephan@rename-it.nl> wrote:
On 11/15/2013 8:41 AM, Steffen Kaiser wrote:
Hi Stephan, about #3 how about the variable extension? I never used it so far, but it should work
Congratulations! You fell into the same trap I did when I first saw this problem. :)
Consider this header:
To: user@dept.example.com, user@example.com, user@other.domain
require "fileinto"; require "relational";
require "variables";
set "done" "0";
if address :is :domain "To" "dept.example.com" { fileinto "Dept";
set "done" "1";
}
The variable "done" is set to "1", due to the first address.
if allof ( address :value "ne" :domain "To" "dept.example.com", anyof ( address :matches :domain "To" "*.example.com", address :is :domain "To" "example.com")) { fileinto "Company";
set "done" "1";
}
The variable "done" is set to "1", due to the second address. And now that I think of it, it would also work on the combination of the first and the third, making this rule still inadequate.
if string :is "${done}" "0" { fileinto "other"; }
Since "done" is set to "1", the message is not filed into "other". But that is wrong, due to the presence of the third address.
See the core of the problem now? :)
Regards,
Stephan.
participants (1)
-
Yanko Hernández Álvarez