Hi! I've some mail accounts own to the same domain and I want to clear all emails from them (not the account). It's possible? i.e. I've: [email protected], [email protected], [email protected] and [email protected]. I want to empty all emails from mailboxes person1 to person3. I don't know if it's possible without deleting the account and reconfig. Thanks.
Probably the easiest way is to use your mail client, use the mail clients search function to select emails and then move them to junk folder and empty junk folder.
I've each account configured in single computers (one account, one pc), then I'd to move from each computer to another. I've 30 accounts aprox. I'd like to avoid that,
Then you'll probably have to write a script or program (or find one if someone has written such a thing already) which opens each mailbox via IMAP protocol (or alternatively opens each mail file and parses it for the from and to headers), checks each mail for the criteria you want to filter mails for deletion, and then removes them via IMAP delete command.
Naaa, finally I deleted all accounts an recreate them. This functionality could be added in future versions . And a checkbox could be added too that allow selecting some mailboxes and deleting them. Thanks.
Code: doveadm expunge -u [email protected] mailbox 'INBOX' all doveadm expunge -u [email protected] mailbox 'INBOX.*' all 1st line deletes all mail from the inbox, 2nd line deletes mail from all folders except the inbox.
But that's not what you initially asked for, as far as I can see from your first post. Your initial question was to delete just specific emails based on the sender and not to empty a complete mailbox. Emptying a mailbox is easy and explained by @nhybgtvfr while deleting just some emails depending on the sender is not.
Thanks for the answers. I'll try the @nhybgtvfr solution. Sorry about my original post if it was misunderstood. I said "want to empty all emails from mailboxes person1 to person3" not certain emails. I should use: empty the complete mailboxes. Sorry.
Thank you for the clarification. I thought you wanted to remove only emails sent from person1 to person3.