| From | Sent On | Attachments |
|---|---|---|
| Leonidas Safran | Jul 21, 2007 3:25 pm | |
| Jérôme Blion | Jul 21, 2007 3:45 pm | |
| Jeff Jansen | Jul 21, 2007 10:36 pm | |
| Leonidas Safran | Jul 22, 2007 5:56 am | |
| Sam Varshavchik | Jul 22, 2007 7:23 am |
| Subject: | Re: [courier-users] How to empty e-mail accounts | |
|---|---|---|
| From: | Jeff Jansen (tech...@sil.org) | |
| Date: | Jul 21, 2007 10:36:09 pm | |
| List: | net.sourceforge.lists.courier-users | |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Leonidas Safran wrote:
I even think it might not be a courier specific command, but more an IMAP standard.. whatever... how do I "delete" all e-mails of an e-mail account, on system side (not with an e-mail client)? I don't want to delete the account, only all e-mails.
Courier uses "maildirs" for storing messages. A maildir is a directory (usually called "Maildir" if you are using courier as your MTA as well) which has three directories in it: 'new', 'cur', and 'tmp'. All the mail in an account's INBOX will be in the 'new' or 'cur' directories, one file per message.
So to delete all the messages in an account's INBOX, you delete all the files in the 'new' and 'cur' directories within that account's maildir. Don't delete the 'new' and 'cur' directories themselves or you'll mess up the account. Just delete the files inside them.
So assuming you want to delete all the mail in the maildir
/home/leonidas/Maildir
you would run from the command line
rm -f /home/leonidas/Maildir/{new,cur}/*
and all the mail in the INBOX is gone.
If you want to delete ALL the mail in all the directories within this account, then you need to delete all the files in all the 'new' and 'cur' directories within that maildir. So you would run
rm -f /home/leonidas/Maildir/{new,cur}/* rm -f /home/leonidas/Maildir/.*/{new,cur}/*
The first line gets rid of the INBOX, the next gets rid of any mail in all the folders.
If you just want to get rid of mail in a particular folder (not the INBOX) then you find that folder on the disk by looking for it inside the main maildir, where the directory name on the disk is the same as the folder in the account, except it will begin with a period (.). So if you are looking for a folder called "Sent" in that account, then all the mail will be in the 'new' and 'cur' directories of the directory
/home/leonidas/Maildir/.Sent
so
rm -f /home/leonidas/Maildir/.Sent/{new,cur}/*
will empty the "Sent" folder. Folder within folders follow the same structure except that periods separate the levels. So if your mail account has a "Sent" folder, with a "2005" folder inside that, with a "June" folder inside that, on the disk it will be located in the directory
/home/leonidas/Maildir/.Sent.2004.June
Wheew! That's probably more information that you needed. :-) But it ought to let you delete the mail in any folder that you want.
HTH
Jeff Jansen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGouzfGfIHDMaiC9cRAlNdAKCbgbUvAleW/lAtHlBtiNrodZu8XACcD8Ul Jx2CdJllQIP0D+SxO1RHRyw= =AUyT -----END PGP SIGNATURE-----





