cancel
Showing results for 
Search instead for 
Did you mean: 

Emptying the IMAP 'Spam' folder using telnet

Emptying the IMAP 'Spam' folder using telnet

Emptying the IMAP 'Spam' folder using telnet

Sometimes your 'Spam' folder may get so full of junk email that you receive Connection dropped by IMAP server errors when you try logging into Webmail. If this happens to you then you can empty the 'Spam' folder using a program called 'telnet'.
Open a command prompt or terminal window and telnet to IMAP server like this (note customers of vISPs other than Plusnet should enter the IMAP server for their service in place of imap.plus.net, e.g. imap.force9.net for Force9):


C:\Users\Bobby>telnet imap.plus.net 143
* OK [CAPABILITY IMAP4rev1 CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFER
ENCES SORT QUOTA] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc.
  See COPYING for distribution information.


Next you need to login. Note here that each command needs to start with a separator of some sort followed by a <space>. Here I've used the letter 'a':

a login $username $passwd
a OK LOGIN Ok.


Where $username and $passwd are replaced with your mailbox username and password.
Next list the directories on the server:

a list """*"
* LIST (\HasNoChildren) "." "INBOX.Virus"
* LIST (\HasNoChildren) "." "INBOX.Drafts"
* LIST (\HasNoChildren) "." "INBOX.Trash"
* LIST (\HasNoChildren) "." "INBOX.Sent"
* LIST (\HasNoChildren) "." "INBOX.Spam"
* LIST (\Unmarked \HasChildren) "." "INBOX"


You'll see the 'Spam' folder in this list. Now what we'll do is delete it completely:

a delete INBOX.Spam
a OK Folder deleted.


Now re-create the 'Spam' folder:

a create INBOX.Spam
a OK "INBOX.Spam" created.


Remember to log-out else the above may not work:

a logout
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed


Now, when you login to Webmail you should find an empty 'Spam' folder awaiting you!
0 Thanks
2 Comments
924 Views
2 Comments
Seasoned Pro
1) The commands are not case sensitive.
2) Don't prepend a '. ' in Linux
use, say 'a '
thanks, i've changed the separator to an 'a' and made the commands lowercase although you do realise you could of done that yourself don't you? Wink