Re: [courier-users] How to empty e-mail accounts

This is a discussion on Re: [courier-users] How to empty e-mail accounts within the Courier-Imap forums, part of the Mail Servers and Related category; -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Leonidas Safran wrote: > I even think it might not be a courier specific ...


Go Back   Usenet Forums > Mail Servers and Related > Courier-Imap

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-22-2007
Jeff Jansen
 
Posts: n/a
Default Re: [courier-users] How to empty e-mail accounts

-----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-----

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/.../courier-users
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:47 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0