[Dovecot] Automatic expire on post-login

Antonio Perez-Aranda aperezaranda at yaco.es
Wed Nov 24 11:47:22 EET 2010

Well, I jet get a valid config for a post-login script as is shown in


This is the content of dovecot.conf:

service imap {
    executable =  imap imap-postlogin

service imap-postlogin {
  executable = script-login /postlogin.sh
  user = root
  unix_listener imap-postlogin {

This is the content of postlogin.sh

/usr/local/bin/doveadm -D expunge -A mailbox Trash savedbefore 30d
/usr/local/bin/doveadm -D expunge -A mailbox MarcaSpam savedbefore 1w
exec $*

2010/11/24 Antonio Perez-Aranda <aperezaranda at yaco.es>:
> I need to clear two folder from Maildir at login.
> Exatly, delete all mails older than 30 days on Trash and 1 day on spam folder.
> I'm using dovecot 2.0 and I think about use a post-login script
> calling doveadm -u $user expunge but post-login scripts in dovecot 2.0
> are very complex
> Is there possible to get the environment vars like on dovecot 1.2 ?
> I think this action must be done by expire plugin, but it isn't the
> work method if as I understand after read wiki2.dovecot.org about
> expire plugin, It run only with a cronjob.

More information about the dovecot mailing list