# Dovecot delete certain message



## lucas1 (Feb 17, 2022)

Good afternoon.

You need to delete a specific mail message  from a specific mailbox.
Stopping dovecot, deleting dovecot index files, delete file mail message did not give any result.
Delete from MUA - delete, but then mail message reappears from somewhere

I execute commands:

`doveadm search -u USER HEADER Message-ID '8f00d64490aa0a7247a4f5fb0ff0827f@walmart.com'`
0c6311037451216158c61d00ef338e69 222661
Command SEARCH finds this message.

`doveadm expunge -u USER MAILBOX '*' HEADER Message-ID '8f00d64490aa0a7247a4f5fb0ff0827f@walmart.com'`
Command EXPUNGE runs, but message remains.

Generally how to remove this is an  message?


----------



## msplsh (Feb 17, 2022)

-A option?


----------



## putney (Feb 17, 2022)

Did your MUA just move the message to an IMAP Trash folder when you asked it to delete? If that was the case, you'd have to empty the Trash to get the MUA to send a delete message to dovecot, and only then would expunge finally get rid of it. Maybe!


----------



## lucas1 (Feb 18, 2022)

msplsh said:


> -A option?


When I put this option there are some incomprehensible errors:
doveadm search -A HEADER Message-ID '8f00d64490aa0a7247a4f5fb0ff0827f@walmart.com'
doveadm(nobody): Error: mkdir(//Maildir) failed: Permission denied (euid=65534(nobody) egid=65534(nobody) missing +w perm: /, dir owned by 0:0 mode=0555)

doveadm  search -u sgk HEADER Message-ID '8f00d64490aa0a7247a4f5fb0ff0827f@walmart.com'
0c6311037451216158c61d00ef338e69 228411
0c6311037451216158c61d00ef338e69 245700
doveadm expunge -u sgk MAILBOX '*' HEADER Message-ID '8f00d64490aa0a7247a4f5fb0ff0827f@walmart.com'
doveadm  search -u sgk HEADER Message-ID '8f00d64490aa0a7247a4f5fb0ff0827f@walmart.com'
0c6311037451216158c61d00ef338e69 245742

There were 2 messages today, one was successfully deleted EXPUNGE.
The second only after the stop dovecot is deleted through the file system and then reappeared.

Now the message file is in the list of files, but when you open this file : file not found.


----------



## lucas1 (Feb 18, 2022)

putney said:


> Did your MUA just move the message to an IMAP Trash folder when you asked it to delete? If that was the case, you'd have to empty the Trash to get the MUA to send a delete message to dovecot, and only then would expunge finally get rid of it. Maybe!


When enable Microsoft Outlook in offline and delete this message it does not fall into Trash.


----------



## lucas1 (Feb 18, 2022)

lucas1 said:


> When enable Microsoft Outlook in offline and delete this message it does not fall into Trash.





putney said:


> Did your MUA just move the message to an IMAP Trash folder when you asked it to delete? If that was the case, you'd have to empty the Trash to get the MUA to send a delete message to dovecot, and only then would expunge finally get rid of it. Maybe!


In general, yes, only through Microsoft Outlook it turned out to delete the unwanted message.
It was necessary to find exactly Microsoft Outlook one of the total number that were connected to this mailbox and which created problems
Doveadm it was useless.


----------



## msplsh (Feb 18, 2022)

sounds like a job for sudo [make me a sandwich]


----------

