sieve and imapflags?
Mike Eggleston
mikeegg1 at mac.com
Wed Aug 29 13:25:48 EDT 2007
I'm still testing and still trying to get a response from vacation.
I came across that sieve had the functionality for modifying the
imap flags. For junk messages messages tagged as spam I want the
message file and the \\seen and \\deleted flags set. My script is:
-------------------------------------- sieve script
# load the necessary components
# fileinto is for filtering
# vacation is ... well ... just that
require ["fileinto", "vacation", "imapflags"];
# save a copy of inbound messages
fileinto "INBOX.backup";
# main filtering rules
if header :contains "Subject" "testing vacation" {
vacation :days 4 "I'm testing, ok?!";
fileinto "INBOX.howard";
} elsif address :contains ["to","from","cc","bcc"] ["@mac.com","admin5@$domain.com"] {
vacation :days 4 "I'm testing, ok?! (2)";
} elsif header :contains "Subject" "*** SPAM ***" {
fileinto "INBOX.spam";
setflag ["\\seen", "\\deleted"];
} elsif header :contains "Subject" "*** VIRUS" {
fileinto "INBOX.spam";
} elsif header :contains "Subject" "/usr/bin/fetchmail" {
fileinto "INBOX.spam";
setflag ["\\seen", "\\deleted"];
} elsif header :contains "Subject" "[ppml]" {
fileinto "INBOX.arin";
setflag "\\seen";
} elsif address :contains ["to","from","cc","bcc"] "hobbit@$domain.com" {
fileinto "INBOX.hobbit";
setflag ["\\seen", "\\deleted"];
} elsif address :contains ["to","from","cc","bcc"] "monit@$domain.com" {
fileinto "INBOX.hobbit";
setflag ["\\seen", "\\deleted"];
} elsif address :contains ["to","from","cc","bcc"] "ipcop@$domain.com" {
fileinto "INBOX.hobbit";
setflag ["\\seen", "\\deleted"];
} elsif address :contains ["to","from","cc","bcc"] "Mail Delivery Subsystem" {
fileinto "INBOX.messages";
setflag ["\\seen", "\\deleted"];
} elsif address :contains ["to","from","cc","bcc"] "Courier mail server" {
fileinto "INBOX.messages";
setflag ["\\seen", "\\deleted"];
} elsif header :contains "Subject" "NOTICE: mail delivery status" {
fileinto "INBOX.messages";
setflag ["\\seen", "\\deleted"];
} elsif header :contains "Subject" "Returned mail: see transcript for details" {
fileinto "INBOX.messages";
setflag ["\\seen", "\\deleted"];
} elsif header :contains "Subject" "Postmaster notify: see transcript for details" {
fileinto "INBOX.messages";
setflag ["\\seen", "\\deleted"];
} else {
fileinto "INBOX";
}
-------------------------------------- sieve script
I'm testing the lines that are 'setflag' or 'addflag'. I've
changed the 'addflag' lines to 'setflag', but neither line
seems to work. I've also tried 'fileinto :flags "\\seen" INBOX.spam',
but this didn't work either.
See anything wrong?
fedora core 5
cyrus imap 2.3.1
Mike
More information about the Info-cyrus
mailing list