[Dovecot] Dovecot Expire doesn't work
Hello,
I'm using dovecot and I want to use the "expire" plugin. However, it doesn't work, i.e. mails do not get deleted.
I ran /usr/sbin/dovecot --exec-mail ext /usr/libexec/dovecot/expire-tool --test
and besides printing
Info: stef/Trash: no messages left Info: stef/Spam: no messages left
it doesn't do anything (especially not deleting e-mails). Obviously, in stef/Trash and stef/Spam, there are e-mails waiting to be deleted.
I'm using dbox as mail storage; and use dbox:/var/mail/%u as mail_location in dovecot.conf. Furthermore, I'm running 1.1.16 on a gentoo PPC system.
This is the output from dovecot -n
# 1.1.16: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.29-gentoo-r2 ppc Gentoo Base System release 1.12.11.1 xfs
listen: *, [::]
ssl_cert_file: /etc/ssl/dovecot/server.pem
ssl_key_file: /etc/ssl/dovecot/server.key
login_dir: /var/run/dovecot/login
login_executable: /usr/libexec/dovecot/imap-login
verbose_proctitle: yes
mail_privileged_group: mail
mail_location: dbox:/var/mail/%u
mail_plugins: expire
auth default:
verbose: yes
debug: yes
passdb:
driver: pam
args: *
userdb:
driver: passwd
socket:
type: listen
master:
path: /var/run/dovecot/auth-master
mode: 384
plugin:
quota: fs:Disk Quota
expire: Trash 7 Spam 30
expire_dict: proxy::expire
dict:
expire: db:/var/lib/dovecot/expire.db
A strace on /usr/sbin/dovecot --exec-mail ext /usr/libexec/dovecot/expire-tool --test
shows the following output:
mkdir("/var/mail/root", 0770) = -1 EEXIST (File exists) stat64("/var/mail/root/Trash/dbox-Mails", 0xbfda2708) = -1 ENOENT (No such file or directory) write(2, "Info: stef/Trash: no messages lef"..., 35Info: stef/Trash: no messages left ) = 35
which explains why nothing happens (stat64("/var/mail/root/Trash/dbox-Mails", which is empty, it should not even exist, but it passes by a mkdir), but why does it want to check /var/mail/root and not /var/mail/%u (i.e. why no stat64(/var/mail/stef/Trash/dbox-Mails))?
Thanks for your help and kind regards,
-- Stef Simoens
On 6/10/2009, Stef Simoens (stef.simoens@scarlet.be) wrote:
it doesn't do anything (especially not deleting e-mails). Obviously, in stef/Trash and stef/Spam, there are e-mails waiting to be deleted.
It doesn't go by the email date, it goes by the date/time the email was moved into that folder.
In other words, it won't effect emails that were *already* *in* the folder.
Personally, I'd love to see the tool have an option to go by the email date/time instead of when it was moved into the folder...
--
Best regards,
Charles
on 6-11-2009 3:22 AM Charles Marcus spake the following:
On 6/10/2009, Stef Simoens (stef.simoens@scarlet.be) wrote:
it doesn't do anything (especially not deleting e-mails). Obviously, in stef/Trash and stef/Spam, there are e-mails waiting to be deleted.
It doesn't go by the email date, it goes by the date/time the email was moved into that folder.
In other words, it won't effect emails that were *already* *in* the folder.
Personally, I'd love to see the tool have an option to go by the email date/time instead of when it was moved into the folder...
So in that case could you move them out and back again? I am considering using the plugin, but I'm still in the info gathering phase.
On Thu, 2009-06-11 at 15:27 -0700, Scott Silva wrote:
on 6-11-2009 3:22 AM Charles Marcus spake the following:
On 6/10/2009, Stef Simoens (stef.simoens@scarlet.be) wrote:
it doesn't do anything (especially not deleting e-mails). Obviously, in stef/Trash and stef/Spam, there are e-mails waiting to be deleted.
It doesn't go by the email date, it goes by the date/time the email was moved into that folder.
In other words, it won't effect emails that were *already* *in* the folder.
Personally, I'd love to see the tool have an option to go by the email date/time instead of when it was moved into the folder...
So in that case could you move them out and back again? I am considering using the plugin, but I'm still in the info gathering phase.
You only need to move one mail into the mailbox so that the mailbox gets added to the database. Once that mail gets expunged, all the other old existing mails get expunged along with it.
On 6/11/2009 6:37 PM, Timo Sirainen wrote:
it doesn't do anything (especially not deleting e-mails). Obviously, in stef/Trash and stef/Spam, there are e-mails waiting to be deleted.
It doesn't go by the email date, it goes by the date/time the email was moved into that folder.
In other words, it won't effect emails that were *already* *in* the folder.
Personally, I'd love to see the tool have an option to go by the email date/time instead of when it was moved into the folder...
So in that case could you move them out and back again? I am considering using the plugin, but I'm still in the info gathering phase.
You only need to move one mail into the mailbox so that the mailbox gets added to the database. Once that mail gets expunged, all the other old existing mails get expunged along with it.
!? This isn't what you said when this was discussed earlier earlier:
On 2/4/2009 12:17 PM, Timo Sirainen wrote:
On Wed, 2009-02-04 at 11:27 +0100, Nicolas Letellier wrote:
Info: user3@domain.tld/Trash: stop, expire time in future: Wed Feb 4 21:00:50 2009
Why this message? I have 3 mailboxes, and the message appears only with this mailbox. The 2 others mailbox have mails into Trash and Junk folders. And the mail are older than 2 days. An ls -lcs say it.
Dovecot tracks the timestamp when the message was copied to Trash, not necessary its ctime. So you probably copied the message to Trash on Feb 3 21:00:50, which is why it'll get expunged at Feb 4 21:00:50.
In a mailbox1, I have this into Junk/cur directory: 4 -rw------- 1 dovecot dovecot 3822 Feb 2 13:39 1233569469.M275631P48216.***.***.net,S=3822,W=3945:2,S 4 -rw------- 1 dovecot dovecot 3004 Feb 2 15:43 1233585799.M730005P46882.***.***.net,W=3078,S=3004:2,S 4 -rw------- 1 dovecot dovecot 3056 Feb 2 17:49 1233587786.M676156P51401.***.***.net,S=3056,W=3132:2,S 4 -rw------- 1 dovecot dovecot 3732 Feb 2 17:49 1233592892.M701994P52459.***.***.net,S=3732,W=3823:2,S
We are Feb 4, and these message are always here. No informations with mail_debug, or with --test parameter.These messages were arrived Feb 2, and they might have this date in dovecot.index.cache...
Was expire plugin enabled then? If it wasn't, it didn't add them to its database so it doesn't know about them.
... has this changed? Or am I seriosuly misunderstanding what you said? Or... you said 'the mailbox'... does this apply only to mbox files, or to maildirs too? Thanks for the clarification Timo... -- Best regards, Charles
On Jun 12, 2009, at 7:09 AM, Charles Marcus wrote:
You only need to move one mail into the mailbox so that the mailbox gets added to the database. Once that mail gets expunged, all the other old existing mails get expunged along with it.
!? This isn't what you said when this was discussed earlier earlier:
I thought I said it several times i several different ways and added a sentence about it to wiki too.. Expire plugin doesn't track each message individually. It only keeps a track of records: <mailbox name> <next timestamp when to look into this mailbox> When the timestamp is reached, it opens the mailbox and expunges all the messages that have old enough save-date.
On 2/4/2009 12:17 PM, Timo Sirainen wrote:
On Wed, 2009-02-04 at 11:27 +0100, Nicolas Letellier wrote:
Info: user3@domain.tld/Trash: stop, expire time in future: Wed Feb 4 21:00:50 2009
Why this message? I have 3 mailboxes, and the message appears only with this mailbox. The 2 others mailbox have mails into Trash and Junk folders. And the mail are older than 2 days. An ls -lcs say it.
Dovecot tracks the timestamp when the message was copied to Trash, not necessary its ctime. So you probably copied the message to Trash on Feb 3 21:00:50, which is why it'll get expunged at Feb 4 21:00:50.
In a mailbox1, I have this into Junk/cur directory: 4 -rw------- 1 dovecot dovecot 3822 Feb 2 13:39 1233569469.M275631P48216.***.***.net,S=3822,W=3945:2,S 4 -rw------- 1 dovecot dovecot 3004 Feb 2 15:43 1233585799.M730005P46882.***.***.net,W=3078,S=3004:2,S 4 -rw------- 1 dovecot dovecot 3056 Feb 2 17:49 1233587786.M676156P51401.***.***.net,S=3056,W=3132:2,S 4 -rw------- 1 dovecot dovecot 3732 Feb 2 17:49 1233592892.M701994P52459.***.***.net,S=3732,W=3823:2,S
We are Feb 4, and these message are always here. No informations with mail_debug, or with --test parameter.These messages were arrived Feb 2, and they might have this date in dovecot.index.cache...
Was expire plugin enabled then? If it wasn't, it didn't add them to its database so it doesn't know about them.
... has this changed?
I'm not sure what above you think contradicts anything I said..
Or am I seriosuly misunderstanding what you said?
Possibly :)
Or... you said 'the mailbox'... does this apply only to mbox files, or to maildirs too?
Expire plugin works the same way with both.
On 6/12/2009, Timo Sirainen (tss@iki.fi) wrote:
In a mailbox1, I have this into Junk/cur directory: 4 -rw------- 1 dovecot dovecot 3822 Feb 2 13:39 1233569469.M275631P48216.***.***.net,S=3822,W=3945:2,S 4 -rw------- 1 dovecot dovecot 3004 Feb 2 15:43 1233585799.M730005P46882.***.***.net,W=3078,S=3004:2,S 4 -rw------- 1 dovecot dovecot 3056 Feb 2 17:49 1233587786.M676156P51401.***.***.net,S=3056,W=3132:2,S 4 -rw------- 1 dovecot dovecot 3732 Feb 2 17:49 1233592892.M701994P52459.***.***.net,S=3732,W=3823:2,S
We are Feb 4, and these message are always here. No informations with mail_debug, or with --test parameter.These messages were arrived Feb 2, and they might have this date in dovecot.index.cache...
Was expire plugin enabled then? If it wasn't, it didn't add them to its database so it doesn't know about them.
... has this changed?
I'm not sure what above you think contradicts anything I said..
It doesn't, I'm just dense... ;) Thx... And incidentally, I don't see how you can be so patient... my hat's off to you... :) -- Best regards, Charles
Hello,
I know how the expire plugin (should) work. I am actually happy that the expire-plugin works as is is defined.
However, the plugin does not work.
- the folder /var/mail/root is created (empty) for no reason (root mails should be forwarded to me, stef)
- the mails in /var/mail/stef/Spam and/or /var/mail/stef/Trash are not expunged after the determined time
As written in my original mail, I did a strace
. In the strace, I see
that expire-tool 'reads' /var/mail/root and 'reports' that
/var/mail/stef has no e-mails.
So, I see two options:
- I made a configuration error (but I don't see it, and I did some serious looking via google and on the wiki, but maybe it's so obvious I didn't pay attention)
- there is a bug in expire-tool
I wrote this e-mail because I suspect the latter [but please inform me if it's the first]
Thanks for your consideration
Stef
Scott Silva schreef:
on 6-11-2009 3:22 AM Charles Marcus spake the following:
On 6/10/2009, Stef Simoens (stef.simoens@scarlet.be) wrote:
it doesn't do anything (especially not deleting e-mails). Obviously, in stef/Trash and stef/Spam, there are e-mails waiting to be deleted.
It doesn't go by the email date, it goes by the date/time the email was moved into that folder.
In other words, it won't effect emails that were *already* *in* the folder.
Personally, I'd love to see the tool have an option to go by the email date/time instead of when it was moved into the folder...
So in that case could you move them out and back again? I am considering using the plugin, but I'm still in the info gathering phase.
On Thu, 2009-06-11 at 02:43 +0200, Stef Simoens wrote:
mail_location: dbox:/var/mail/%u
This doesn't work with expire-tool, because the way
A strace on
/usr/sbin/dovecot --exec-mail ext /usr/libexec/dovecot/expire-tool --test
works is that dovecot binary first reads dovecot.conf and expands all %u to root. Then it executes expire-tool, which no longer sees %u at all there. The only way to get this working is to have userdb return the path. So:
a) mail_location = dbox:~/ and have userdb return home.
b) Have userdb return mail=dbox:/var/mail/<username>
userdb: driver: passwd
You should be able to do either of those with something like:
userdb passwd { args = mail=dbox:/var/mail/%u }
v2.0 fixes this problem properly.
Hey Timo,
You should be able to do either of those with something like:
userdb passwd { args = mail=dbox:/var/mail/%u }
v2.0 fixes this problem properly.
This works great ...
I didn't know that my (quite simple) setup wasn't supported in this way ... maybe adding a note in the Wiki or so?
Thanks for your help.
Stef
Stef Simoens schreef:
Hey Timo,
You should be able to do either of those with something like:
userdb passwd { args = mail=dbox:/var/mail/%u }
v2.0 fixes this problem properly.
This works great ... Hmm, I cheered too fast. The expire-plugin works ... but now my e-mails are delivered in ~ (which I don't want)
I tried both mail_location = dbox:~/
userdb passwd { args = mail=dbox:/var/mail/%u }
and
mail_location = dbox:~/
userdb passwd { args = home=/var/mail/%u mail=dbox:/var/mail/%u }
... but both seem to prefer delivering my e-mail in ~
-- Stef Simoens stef.simoens@numericable.be +32 486 577 963 http://users.numericable.be/stef
On Mon, 2009-06-22 at 22:28 +0200, Stef Simoens wrote:
Stef Simoens schreef:
Hey Timo,
You should be able to do either of those with something like:
userdb passwd { args = mail=dbox:/var/mail/%u }
v2.0 fixes this problem properly.
This works great ... Hmm, I cheered too fast. The expire-plugin works ... but now my e-mails are delivered in ~ (which I don't want)
Set auth_debug=yes and mail_debug=yes, what does it log?
I didn't know that my (quite simple) setup wasn't supported in this way ... maybe adding a note in the Wiki or so?
I added one yesterday.
Timo Sirainen schreef:
Set auth_debug=yes and mail_debug=yes, what does it log?
Jun 22 22:48:09 robin dovecot: auth(default): master out: USER^I1^Istef^Ihome=/var/mail/stef^Imail=dbox:/var/mail/stef^Isystem_user=stef^Iuid=1000^Igid=1000 Jun 22 22:48:09 robin dovecot: IMAP(stef): Loading modules from directory: /usr/lib/dovecot/imap Jun 22 22:48:09 robin dovecot: IMAP(stef): Module loaded: /usr/lib/dovecot/imap/lib20_expire_plugin.so Jun 22 22:48:09 robin dovecot: IMAP(stef): Effective uid=1000, gid=1000, home=/var/mail/stef Jun 22 22:48:09 robin dovecot: IMAP(stef): dbox: data=/var/mail/stef Jun 22 22:48:09 robin dovecot: IMAP(stef): fs: root=/var/mail/stef, index=, control=, inbox= Jun 22 22:48:09 robin dovecot: IMAP(stef): Disconnected: Logged out bytes=44/298 (...) Jun 22 22:48:56 robin deliver(stef): Loading modules from directory: /usr/lib/dovecot/lda Jun 22 22:48:56 robin deliver(stef): Module loaded: /usr/lib/dovecot/lda/lib20_expire_plugin.so Jun 22 22:48:56 robin deliver(stef): Module loaded: /usr/lib/dovecot/lda/lib90_cmusieve_plugin.so Jun 22 22:48:56 robin deliver(stef): dbox: data=/home/stef/ Jun 22 22:48:56 robin deliver(stef): fs: root=/home/stef, index=, control=, inbox= Jun 22 22:48:56 robin deliver(stef): cmusieve: Using sieve path: /home/stef/.dovecot.sieve Jun 22 22:48:56 robin deliver(stef): cmusieve: Executing script /home/stef/.dovecot.sievec Jun 22 22:48:56 robin deliver(stef): msgid=05b564d81f8186e0fecc293288ba5eb9.squirrel@www.bunderbos: saved mail to INBOX
I did restart the dovecot daemon after each configuration change, but I didn't restart postfix, did I have to?
Kr,
Stef
-- Stef Simoens stef.simoens@numericable.be +32 486 577 963 http://users.numericable.be/stef
On Mon, 2009-06-22 at 23:19 +0200, Stef Simoens wrote:
Jun 22 22:48:56 robin deliver(stef): dbox: data=/home/stef/
Oh, so it's only deliver that's broken. I guess you aren't giving -d parameter to deliver so it's not doing a userdb lookup. But there's no need to add it, just keep what you had originally:
mail_location = dbox:/var/mail/%u
expire-tool (and imap, pop3, etc.) will just override it from the mail returned by userdb lookup.
Timo Sirainen schreef:
On Mon, 2009-06-22 at 23:19 +0200, Stef Simoens wrote:
Jun 22 22:48:56 robin deliver(stef): dbox: data=/home/stef/
Oh, so it's only deliver that's broken. I guess you aren't giving -d parameter to deliver so it's not doing a userdb lookup. But there's no need to add it, just keep what you had originally:
mail_location = dbox:/var/mail/%u
expire-tool (and imap, pop3, etc.) will just override it from the mail returned by userdb lookup.
Hello Timo,
This works. Thanks for your investigation and time.
deliver uses mail_location = dbox:/var/mail/%u -- my e-mail gets delivered correctly
and all the other compontents use the path from userdb. I used "args = home=/var/home/%u mail=dbox:/var/mail/%u" -- and my e-mail gets expired correctly, too
Kind regards,
Stef
-- Stef Simoens stef.simoens@numericable.be +32 486 577 963 http://users.numericable.be/stef
participants (4)
-
Charles Marcus
-
Scott Silva
-
Stef Simoens
-
Timo Sirainen