1 (edited by alex42 2015-10-25 07:13:19)

Topic: Auto delete emails in users trash?

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.2
- Linux/BSD distribution name and version: Ubuntu 14.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
====

Hi,

does support iRedMail the automatic deletion of mails in users trash older than x-days? And if yes, how can I activate it?

----

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

2

Re: Auto delete emails in users trash?

Dovecot has command for this:
http://wiki2.dovecot.org/Tools/Doveadm/Expunge

3

Re: Auto delete emails in users trash?

Thats great! Created a little script to do it per cron:

sudo nano /usr/local/bin/dovecot_expunge.sh
#!/bin/bash
#
DOVEADM="/usr/bin/doveadm";

$DOVEADM expunge -A mailbox Trash savedbefore 3d
$DOVEADM expunge -A mailbox Junk  savedbefore 30d

Then I made the script executable:

sudo chmod +x /usr/local/bin/dovecot_expunge.sh

and finally added it to the crontab:

sudo crontab -e
#dovecot delete spam & trash
0 4 * * * /usr/local/bin/dovecot_expunge.sh

It should delete emails in Trash older than 3 days and in Junk older than 30 days.

4

Re: Auto delete emails in users trash?

Thanks for sharing. smile