[Dovecot] When should dictionary entries for the expire plugin be added/updated?
Ralph Seichter
dovecot-ml at seichter.de
Tue Aug 24 21:18:04 EEST 2010
I've set up Dovecot 2.0 with the expire plugin using an SQLite DB, and
when mail is delivered via dovecto-lda, the DB gets updated as expected.
However, when I use Thunderbird 3.1.2 for Mac OS X to move a message to
any of the folders known to the expire plugin (e.g. the 'tmp' folder),
the SQLite DB is not updated.
Here is an excerpt of my current configuration:
# /etc/dovecot/dovecot.conf
dict {
expire = sqlite:/etc/dovecot/dict-expire.conf
}
plugin {
expire = Junk
expire2 = Trash
expire3 = tmp
expire4 = *.News
expire5 = *.Reports
expire_dict = proxy::expire
sieve = /etc/dovecot/sieve/%u.sieve
}
service dict {
unix_listener dict {
# Ensure that there is no permission-related problem
mode = 0666
}
}
protocol lda {
mail_plugins = expire sieve
postmaster_address = postmaster at domain.tld
sendmail_path = /usr/sbin/sendmail
}
# /etc/dovecot/dict-expire.conf
connect = /var/lib/dovecot/expires.sqlite
map {
pattern = shared/expire/$user/$mailbox
table = expires
value_field = expire
fields {
username = $user
mailbox = $mailbox
}
}
# Schema dump of /var/lib/dovecot/expires.sqlite
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE expires (
username VARCHAR(75) NOT NULL,
mailbox VARCHAR(255) NOT NULL,
expire integer NOT NULL,
PRIMARY KEY (username, mailbox)
);
CREATE TRIGGER mergeexpire BEFORE INSERT ON expires FOR EACH ROW
BEGIN
UPDATE expires SET expire=NEW.expire
WHERE username=NEW.username AND mailbox=NEW.mailbox;
SELECT RAISE(IGNORE)
WHERE (SELECT 1 FROM expires WHERE username=NEW.username AND mailbox=NEW.mailbox) IS NOT NULL;
END;
COMMIT;
With these settings, rows will be inserted to (or updated within)
expires.sqlite when dovecot-lda stores messages to any of my "Reports"
folders using sieve rules. When I manually move messages to "tmp" or
"Junk", the database remains unchanged. Also, when I delete messages in
Thunderbird, I'd expect database additions for the folder "Trash", but
this does not happen either. What am I doing wrong here?
-Ralph
More information about the dovecot
mailing list