# Delete messages automatically

**URL:** <https://discourse.mailinabox.email/t/delete-messages-automatically/8386>\
**Category:** Improvements\
**Created:** [September 6, 2021, 6:37pm UTC](https://discourse.mailinabox.email/t/delete-messages-automatically/8386 "2021-09-06T18:37:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/v/3e96dc/32.png) [@victor](https://discourse.mailinabox.email/u/victor)\
**Post date:** [September 6, 2021, 6:37pm UTC](https://discourse.mailinabox.email/t/delete-messages-automatically/8386/1 "2021-09-06T18:37:40Z")

</div>

Hello, I have a question: Can you create some kind of rule that deletes messages from a folder every so often or something similar?

I need the messages in a folder to be deleted every so often according to some criteria that can be set

Thanks

---

<div class="post-metadata">

**Author:** ![openletter](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/o/f1d935/32.png) [@openletter](https://discourse.mailinabox.email/u/openletter)\
**Post date:** [September 6, 2021, 6:39pm UTC](https://discourse.mailinabox.email/t/delete-messages-automatically/8386/2 "2021-09-06T18:39:50Z")

</div>

I would first check the filter options in Roundcube. Those run even when not logged in.

I would next opt to see if a client has this feature. I use Thunderbird which has a lot of options for filters.

---

<div class="post-metadata">

**Author:** ![victor](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/v/3e96dc/32.png) [@victor](https://discourse.mailinabox.email/u/victor)\
**Post date:** [September 6, 2021, 6:54pm UTC](https://discourse.mailinabox.email/t/delete-messages-automatically/8386/3 "2021-09-06T18:54:16Z")

</div>

How I can open Roundcube? or is it an other package?

---

<div class="post-metadata">

**Author:** ![openletter](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/o/f1d935/32.png) [@openletter](https://discourse.mailinabox.email/u/openletter)\
**Post date:** [September 6, 2021, 6:55pm UTC](https://discourse.mailinabox.email/t/delete-messages-automatically/8386/4 "2021-09-06T18:55:28Z")

</div>

Navigate to `https://box.example.com/mail`.

---

<div class="post-metadata">

**Author:** ![victor](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/v/3e96dc/32.png) [@victor](https://discourse.mailinabox.email/u/victor)\
**Post date:** [September 6, 2021, 7:04pm UTC](https://discourse.mailinabox.email/t/delete-messages-automatically/8386/5 "2021-09-06T19:04:28Z")

</div>

I’m going to keep looking … thanks

---

<div class="post-metadata">

**Author:** ![StevevonSheff](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/ecb155/32.png) [@StevevonSheff](https://discourse.mailinabox.email/u/StevevonSheff)\
**Post date:** [September 24, 2021, 6:44pm UTC](https://discourse.mailinabox.email/t/delete-messages-automatically/8386/6 "2021-09-24T18:44:54Z")

</div>

To activate auto delete add autopurge to the folders in this file:

./etc/dovecot/conf.d/15-mailboxes.conf

Change by adding autoexpunge = 30d. e.g. (30d=30days):

mailbox INBOX {  
auto = subscribe  
autoexpunge = 30d  
}  
mailbox Spam {  
special\_use = \Junk  
auto = subscribe  
autoexpunge = 7d  
}  
mailbox Drafts {  
special\_use = \Drafts  
auto = subscribe  
autoexpunge = 30d  
}  
mailbox Sent {  
special\_use = \Sent  
auto = subscribe  
autoexpunge = 30d  
}  
}

p.s. It will only delete new mails existing ones won’t be deleted.

---

<div class="post-metadata">

**Author:** ![victor](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/v/3e96dc/32.png) [@victor](https://discourse.mailinabox.email/u/victor)\
**Post date:** [September 24, 2021, 7:51pm UTC](https://discourse.mailinabox.email/t/delete-messages-automatically/8386/7 "2021-09-24T19:51:10Z")

</div>

Thanks for you answer!

---

<div class="post-metadata">

**Author:** ![system](https://discourse.mailinabox.email/uploads/default/original/2X/4/4d0933d13c456b7e57f296aa6cc344525b6f0c70.png) [@system](https://discourse.mailinabox.email/u/system)\
**Post date:** [November 6, 2021, 6:38pm UTC](https://discourse.mailinabox.email/t/delete-messages-automatically/8386/8 "2021-11-06T18:38:39Z")

</div>

This topic was automatically closed after 61 days. New replies are no longer allowed.
