is it safe to remove mails on imap server with "rm"?

I use dovecot IMAP server and want to delete big unneeded mails:

cd /var/spool/foouser; du -a | sort -rn > /var/tmp/du-mail-foouser.log

Now I see big mails at the top and after looking at them I want to remove them.

Is it safe to just call

"rm ./foofolder/1318412893.M857530P4656.hz1,W=14463815,S=14268320:2,S"?


Solution 1:

Yes

In this particular case, you are using a 'Maildir' format mailbox. In Maildir, it's safe to use 'rm' to remove an individual piece of email, to use 'mv' to move an individual mail between folders on the same file system, etc.

With other mail storage types, it may not be safe to rm a single email.

More about Maildir:

  • http://cr.yp.to/proto/maildir.html
  • http://en.wikipedia.org/wiki/Maildir