Howto: Access a POP3 Mailbox as a Filesystem

Have you even needed to delete bunch of emails queued up on a POP3 server without actually downloading them? Sure, you could just telnet to port 110 and start deleting them manually, but what if you are dealing with hundreds of emails?

Here is my scenario. A lady calls me today saying that webmail is just unbearably slow for her, and she thinks it’s because she has to many emails in there. Sensing danger I telnetted in, and issued in a LIST command. I after watching the screen scroll for over a minute, I found out that there were over 1500 messages in the mailbox.

After some convincing the owner of the overflowing mailbox conceded to allow me delete everything prior to 2006 from the mailbox. She did not want to loose anything recent. Unfortunately deleting all these emails would not be easy, especially since the standard LIST command does not display dates. So I needed to figure out a better way.

Here is what you will need:

  1. a windows box – unfortunately you need windows for this solution
  2. Total Commander – the windows GUI based clone of Norton Commander/Midnight Commander. Yes, it’s not free, but it has 1 month free trial period.
  3. The POP3 Plugin – a nice plugin for Total Commander which allows you to access POP3 servers

When installing the plugin you will need to specify the location of the Total Commander ini file. This file is usually located in the default windows directory:

C:\WINDOWS\wincmd.ini or
C:\WINNT\wincmd.ini

Once it is installed, open Total Commander. The POP3 access option is hidden under Network Neighborhood drive thing. To get there just click on the drive chooser in either panel and pick [-\-] from the list (by default it should be on [-c-]).

Inside, click on [POP3-SMTP Connections] directory. You can use the [Quick Connection] for a one-time session, or set up a permanent connection by giving it a name. In each case you will be prompted by a dialog asking you for POP3 and SMTP server.

You don’t need to set up SMTP as in this case we only care bout POP. The dialog is a little bit misleading because it looks like it wants you to type in the server address in the box. Unfortunately this is not the case. Click on the magic wand icon to access to proper POP3 login dialog which will ask you for the host name, username and password. It will then format the string which needs to go in the POP3 box appropriately. It should look something like this:

pop3.example.com:EncodedPwd(07F7DA1FB45E45)@username

I’m not exactly sure if the password is just converted to hex ASCII values, or if it is modified in some other way. The magic wand dialog will do the encoding, so you don’t need to worry about this.

Once you click OK, Total Commander should connect to the POP3 server. It will display your POP3 mailbox just as if it was a normal file-system directory full of .eml files. From there you can view or delete any massages with great ease just as if you were working with normal files.

Quick warning – Total Commander may appear to freeze while establishing the connection. This is normal, especially if your mailbox is huge. Just let it sit for a while and it will spring back to life.

Also, once I deleted bunch of files (around 200 at a time) TC disconnected from the server and returned to [-\-] forcing me to reconnect. No work was lost, and the emails were deleted as they should – it simply closed the connection after the task was done.

If you ever needed this type of access to POP3 mailboxes, definitely check it out. This nifty plugin might make worth buying the TC license something you might want to consider.

[tags]pop3, email, smtp, pop3 as filesystem, total commander, pop3 plugin, pop3 plugin total commander, email plugin[/tags]

This entry was posted in technology and tagged . Bookmark the permalink.



7 Responses to Howto: Access a POP3 Mailbox as a Filesystem

  1. Luke UNITED STATES Mozilla Firefox Windows says:

    As a rule, I don’t submit my email username and passwords to 3rd party sites. So, what does that thing do?

    Btw, I’m assuming this works for Gmail only. The method I described above works for any POP3 email.

    Reply  |  Quote
  2. teamcoltra UNITED STATES Mozilla Firefox Windows says:

    Yeah, its kinda a personal thing for me but its a really cool tool. I was just showing another cool thing that does something similar. I hate computer based things I like doing everything virtually.

    Reply  |  Quote
  3. ths UNITED KINGDOM Mozilla Firefox Windows Terminalist says:

    use perl;
    it has a wonderful POP3 module (cpan.org) and in 20 lines you can write a mail killer for all sorts of criteria. no need to setup windows box or buy TC.

    #!/usr/bin/perl
    use Net::POP3;
    $pop = Net::POP3->new( shift, Timeout => 15, Debug => 0 ) ||
    die “#! Could not connect: $!”;
    $rc=($pop->apop($user,$pass); # or $pop->login($u,$p))

    $msgs=$pop->list();
    ($num,$size)=$pop->popstat();

    foreach my $msgnum (sort(keys(%{$msgs}))) {
    my ($msg);

    print STDERR “# Msg $msgnum\n”;
    $msg=$pop->top($msgnum);
    chomp(@{$msg});
    ($date)=grep(/^Date:\s/,@{$msg});
    $pop->delete($msgnum) if ($date quit();

    Reply  |  Quote
  4. ths UNITED KINGDOM Mozilla Firefox Windows Terminalist says:

    hey, it swallows lt and gt in my perl script. grr.

    the rest should read like

    $pop->delete($msgnum) if ($date meets some condition);
    }
    $pop->quit();

    Reply  |  Quote
  5. Luke Maciak UNITED STATES Mozilla Firefox Ubuntu Linux says:

    @ths – yeah, wordpress eats the brackets in regular comments. Check out the little buttons above the comment box – one of them is labeled “Code”.

    Hit that one and it will put &;t;pre lang=”java”></pre> around highlighted text. Anything inside will be typed out verbatim – including HTML brackets. Oh, and it will do code highlighting. You can change the lang attribute to perl for better effect. The plugin actually does few dozen popular languages. :)

    Pretty cool solution btw! Actually it’s better than mine which was was a bit on the fast and lazy side – just install a plugin for TC, and access the mailbox as a filesystem. ;)

    Reply  |  Quote
  6. This didn’t exist back when you wrote this, but someone wrote a POP3 FUSE filesystem: fuse-mail. A POP3 mailbox can be mounted anywhere, and mail appear as files inside the mount point. Trying it now, it doesn’t seem to work very well, and I ran into a few bugs setting it up.

    I don’t think it would have been useful for your task, either. It seems to only be able to fetch mail and present it. No mail management.

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>