1

Topic: Cleaning other folders - Trash and Junk

==== Required information ====
- iRedMail version: 0.9
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: CentOS 6.5
- Related log if you're reporting an issue: -
====

Hello,

questions about cleaning Trash and Junk folders. Can you help me?

1) I'm using, in CRON, this command:

    55  7   *   *   *   /usr/bin/doveadm expunge -A mailbox Trash savedbefore 30d ; /usr/bin/doveadm expunge -A mailbox Junk savedbefore 60d

Interate sql is ok. I've moved messages from other server today. I have old messages (from 2013) in this folders. The command won't run for 30/60 days because it checks the creation date (today) and not the real message date? Am I right? Command will work after 30/60 from today?

2) I read some lines in dovecot.conf about expire plugin. I've uncommented them. This is enough? Will conflict the CRON entry?

    expire = Trash 30 Trash/* 30 Junk 60 Junk/* 60
    expire_dict = proxy::expire

Also uncommented:

dict {
    expire = db:/var/lib/dovecot/expire/expire.db
...

Will work? Or need to enable something else?

3) I'm in Brazil. OutLook, not sure, sometimes save messages in "Itens Excluídos" instead of "Trash". And "Lixo Eletrônico" instead of "Junk". Doveadm can exclude messages from this folders too? Note that folder name has spaces. Or need another way, like a bash "find... exec rm" thing?

Thank you!!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Cleaning other folders - Trash and Junk

InWeb wrote:

==== Required information ====
- iRedMail version: 0.9
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: CentOS 6.5
- Related log if you're reporting an issue: -
====

Hello,

questions about cleaning Trash and Junk folders. Can you help me?

1) I'm using, in CRON, this command:

    55  7   *   *   *   /usr/bin/doveadm expunge -A mailbox Trash savedbefore 30d ; /usr/bin/doveadm expunge -A mailbox Junk savedbefore 60d

Interate sql is ok. I've moved messages from other server today. I have old messages (from 2013) in this folders. The command won't run for 30/60 days because it checks the creation date (today) and not the real message date? Am I right? Command will work after 30/60 from today?

2) I read some lines in dovecot.conf about expire plugin. I've uncommented them. This is enough? Will conflict the CRON entry?

    expire = Trash 30 Trash/* 30 Junk 60 Junk/* 60
    expire_dict = proxy::expire

Also uncommented:

dict {
    expire = db:/var/lib/dovecot/expire/expire.db
...

Will work? Or need to enable something else?

3) I'm in Brazil. OutLook, not sure, sometimes save messages in "Itens Excluídos" instead of "Trash". And "Lixo Eletrônico" instead of "Junk". Doveadm can exclude messages from this folders too? Note that folder name has spaces. Or need another way, like a bash "find... exec rm" thing?

Thank you!!

1. You are right that it will only work 30/60 days after, worse if using the Expire Plugin which logs the first time an e-mail gets moved to a specific folder per mailbox, [if things are in folder but nothing new gets moved in, it'll never get cleared]

2. The Expire Plugin is only useful on high load servers, it basically keeps track in SQL of which User Accounts have E-Mails that need to be deleted without it having to iterate through each User Account, only beneficial with a LOT of users.

3. The actual folder names, as can be seen in your MailDIR [/var/vmail/vmail1/domain/u/s/e/r/Maildir/ (example, similar)] are such like Junk, Inbox etc. You can set up in Dovecot Folders with different names which symlink to each other, currently set up for the Sent folders. But in this case is it not simply just a localization feature and in fact the e-mails actually get saved in Trash/Junk on the server side?

3

Re: Cleaning other folders - Trash and Junk

Hello 7t3chguy!

Ok about "1" and "2". Should I disable "2" and let only "1", ie, only doveadm in cron (running after midnight)?

About "3", I cannot symlink, folders already exists. For some reason, some versions (maybe old) of OutLook create its own "Junk" and "Trash" folders, in portuguese. So, my doveadm command won't work. I need to know if doveadm can only delete mails from default folders, or can I do something like "doveadm expunge -A mailbox "Itens Excluidos" savedbefore 30d" (folder has a space char). I realized today several users with more than 20000 mails in their "Itens Excluídos" (Trash) and "Lixo Eletrônico" (Junk) folders, since 2012. I didn't find anything on Google about this.

I know how to do using "find... exec rm" but I'm looking for a more elegant method before.

4

Re: Cleaning other folders - Trash and Junk

InWeb wrote:

Hello 7t3chguy!

Ok about "1" and "2". Should I disable "2" and let only "1", ie, only doveadm in cron (running after midnight)?

About "3", I cannot symlink, folders already exists. For some reason, some versions (maybe old) of OutLook create its own "Junk" and "Trash" folders, in portuguese. So, my doveadm command won't work. I need to know if doveadm can only delete mails from default folders, or can I do something like "doveadm expunge -A mailbox "Itens Excluidos" savedbefore 30d" (folder has a space char). I realized today several users with more than 20000 mails in their "Itens Excluídos" (Trash) and "Lixo Eletrônico" (Junk) folders, since 2012. I didn't find anything on Google about this.

I know how to do using "find... exec rm" but I'm looking for a more elegant method before.

I don't mean actually Symlink, read through the dovecof config to see something about multiple Sent Folders, you could add an additional one yourself.
You can disable 2 and 1 will work similarly, if you are planning a large user base then get 2 working. It is not required. And yes DoveADM can Expunge from ANY Folders. I have mine expunging from a SubFolder of a Junk Folder as an example, you can use 'doveadm search ...' instead of 'doveadm expunge ...' to list the e-mails that WOULD get deleted if the expunge command was used instead.

5

Re: Cleaning other folders - Trash and Junk

Hi 7t3chguy,

great, thank you for the information. Really appreciated! I'll do this.

Best.

6

Re: Cleaning other folders - Trash and Junk

Hi guys. Sorry that I push the topic up. I have just little question.
Is it correct that by default iredmail does not clean up Trash folder at all, so all trashed messages stay in Trash folder forever?
Thanks.

7

Re: Cleaning other folders - Trash and Junk

That is correct