简体   繁体   中英

Deleting emails from Dovecot mail server

I have setup a Dovecot mail server on Linux system. It is working fine. I am able to see emails coming into mail server. I have written java code which runs every hour and copies new incoming emails from mail server onto some directory. (working fine).

My question is how can I delete the old emails on the mail server automatically, that is once my java code copies them onto some location mails from mail server should get delete.

I have tried setting properties like flag indicating that email is deleted, read and so on. But this does not helps as emails are not getting deleted on mail server.

So can someone guide me what changes I can make in settings on mail server so that mails get deleted every week/day. Or any other solutions which anyone can suggest.

Thanks in advance.

There is useful tool doveadm that allow to perform various administrative tasks with messages.

That's how you can delete messages from specific folders that are too old:

doveadm expunge -A mailbox Trash savedbefore 62d

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM