[Dovecot] expire plugin

Arnaud2 bali arnaud2 at bali.mailhec.com
Tue Aug 3 11:59:35 EEST 2010


Hi

I try to use expire plugin with mysql
When i use my thunderbird client to delete a message, nothing is write 
in the mysql database.


My maildir is look like /home/vmail/homes/arnaud2 at xxx.xxxx.xxx/

and  /etc/dovecot/dovecot-dict-expire.conf :


connect = host=localhost user=xxxxxx password=xxxxxxxxx dbname=postfixadmin
map {
  pattern = /home/vmail/homes/$user/$mailbox
#shared/expire/$user/$mailbox
  table = dovecot_expires
  value_field = expire_stamp
  fields {
    username = $user
    mailbox = $mailbox
  }
}

Is pattern ok ?

My detail configuration :


# dovecot --version
1.2.11

# dovecot -n
# 1.2.11: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.26-2-amd64 x86_64 Debian 5.0.5
log_timestamp: %Y-%m-%d %H:%M:%S
protocols: imap imaps pop3s managesieve
disable_plaintext_auth: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/lib/dovecot/imap-login
login_executable(imap): /usr/lib/dovecot/imap-login
login_executable(pop3): /usr/lib/dovecot/pop3-login
login_executable(managesieve): /usr/lib/dovecot/managesieve-login
mail_privileged_group: mail
mail_location: maildir:/%h
mbox_write_locks: fcntl dotlock
mail_executable(default): /usr/lib/dovecot/imap
mail_executable(imap): /usr/lib/dovecot/imap
mail_executable(pop3): /usr/lib/dovecot/pop3
mail_executable(managesieve): /usr/lib/dovecot/managesieve
mail_plugins(default): quota expire imap_quota autocreate
mail_plugins(imap): quota expire imap_quota autocreate
mail_plugins(pop3): quota expire autocreate
mail_plugins(managesieve):
mail_plugin_dir(default): /usr/lib/dovecot/modules/imap
mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3
mail_plugin_dir(managesieve): /usr/lib/dovecot/modules/managesieve
lda:
  postmaster_address: xxx at xxxxxxxx.xx
  mail_plugins: quota expire  sieve autocreate
  auth_socket_path: /var/run/dovecot/auth-master
auth default:
  mechanisms: plain login
  verbose: yes
  debug: yes
  debug_passwords: yes
  passdb:
    driver: sql
    args: /etc/dovecot/dovecot-sql.conf
  userdb:
    driver: sql
    args: /etc/dovecot/dovecot-sql.conf
  socket:
    type: listen
    client:
      path: /var/spool/postfix/private/auth
      mode: 432
      user: postfix
      group: postfix
    master:
      path: /var/run/dovecot/auth-master
      mode: 384
      user: vmail
plugin:
  quota: maildir
  expire: .Trash 1 .Trash/* 1 .Spam 2
  expire_dict: proxy::expire
  sieve: ~/.dovecot.sieve
  sieve_after: /home/vmail/sieve/default.sieve
  autocreate: Trash
  autocreate2: Spam
  autocreate3: Sent
  autocreate4: Inbox
  autocreate5: Drafts
  autocreate6: Templates
  autosubscribe: Trash
  autosubscribe2: Spam
  autosubscribe3: Sent
  autosubscribe4: Inbox
  autosubscribe5: Drafts
  autosubscribe6: Templates
dict:
  expire: mysql:/etc/dovecot/dovecot-dict-expire.conf

# cat /etc/dovecot/dovecot-dict-expire.conf
connect = host=localhost user=xxxxxx password=xxxxxxxxx dbname=postfixadmin

map {
  pattern = /home/vmail/homes/$user/$mailbox
#shared/expire/$user/$mailbox
  table = dovecot_expires
  value_field = expire_stamp

  fields {
    username = $user
    mailbox = $mailbox
  }
}
mysql> desc dovecot_expires;
+--------------+--------------+------+-----+---------+-------+
| Field        | Type         | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| username     | varchar(255) | NO   | PRI | NULL    |       |
| mailbox      | varchar(255) | NO   | PRI | NULL    |       |
| expire_stamp | int(11)      | NO   |     | NULL    |       |
+--------------+--------------+------+-----+---------+-------+


# cat /etc/dovecot/dovecot-sql.conf
driver = mysql
connect = host=localhost user=xxxxxxx password=xxxxxxx dbname=postfixadmin
user_query = SELECT CONCAT('/home/vmail/homes/',maildir) AS home, 65500 
AS uid, 65500 AS gid, \
  CONCAT('*:bytes=', CAST(quota AS CHAR)) AS quota_rule \
  FROM mailbox WHERE username = "%u"  AND active=1
password_query = SELECT username as user, password, maildir as 
userdb_home, 65500 as userdb_uid, 65500 as userdb_gid FROM mailbox WHERE 
username = '%u' AND active=1



Thank you


More information about the dovecot mailing list