Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Apple's Mobile Me and am looking for a program that I can leave running on a Unix server somewhere that will monitor the IMAP INBOX and automatically copy all incoming messages to another mailbox (call it Archive).

I've tried implementing this myself in python with imaplib2 and the IDLE command and have found that my connection keeps getting disconnected.

Is there any off-the-shelf open source software that I can use to do this?

share|improve this question
+1 I've frequently considered doing this (or something similar). Would be interested to know what your use-case is. I had a slow inet connection, so wanted an IMAP server on my (personal) LAN that basically mirrored gmail's IMAP. – Andy Jun 12 '10 at 11:04
My use case is that I want a copy of all my incoming mail to go to Archive so that I can delete from the INBOX with abandon, without having to manually archive. I find old email using's built-in search, which really rocks. – vy32 Jun 18 '10 at 19:48
Can Mobile Me forward a copy of all incoming mail to another address? – Craig Jun 19 '10 at 0:07
Not sure, but I want l the mail to stay on same service. – vy32 Jun 21 '10 at 10:26

Something like fetchmail would do the trick. In IMAP mode, it would sit idle on the connection and copy messages to the UNIX box as they arrive.

share|improve this answer
Will fetchmail copy to a different IMAP box? – vy32 Jun 21 '10 at 10:34
That is not something I've tried before, but you could use the -m option of fetchmail to push the mail to another IMAP box using a IMAP command-line application. – Peter Murray Jun 21 '10 at 11:46
Okay. I've researched fetchmail. It doesn't have the capability to do anything but get the mail. Do you have a suitable command-line application that could do this? I guess I could write something with python, but I was looking for a solution that's integrated and already debugged... – vy32 Jun 24 '10 at 1:30
Unfortunately, no -- I don't have anything ready-made. It is possible in theory, but I haven't done it myself. – Peter Murray Jun 25 '10 at 1:30

You can use filters/rules to copy it to another mailbox.

You can forward it to another account and make sure the original stays on the imap server (e.g. with gmail)

share|improve this answer
Forwarding to another account doesn't do what I want. Yes, I realize that I can accomplish this by leaving a client with rules running. That's what I'm trying to avoid. I'm looking for a server-based solution. Unless you know of a suitable client that can run without a user interface on a server... – vy32 Jun 24 '10 at 1:31

You could use Thunderbird and its Message Filters

share|improve this answer
That doesn't work; I want to leave the program running on the Unix server. Thunderbird is a client program. I want this to run when my client is turned off and I'm using the web-mail interface. – vy32 Feb 17 '10 at 13:22

If you've already written something that mostly works, why not extend it to handle the disconnection gracefully and reconnect?

Alternatively, you could schedule imapsync to run at an interval that makes you comfortable.

share|improve this answer
Well, because the framework crashes. I could run it with a wrapper program, but that's kind of missing the point. The problem with imapsync is that there is no good interval that makes sense. Every 5 minutes? If I'm connected to the server and read an email and delete it when it comes in, I won't get a copy of it. (Unless I also sync out of the trash to the archive, which just seems wrong.) Increasingly I feel there is no way to do this without server-side filters. – vy32 Apr 29 '10 at 1:38

Various MDAs allow you to specify delivery rules via a file in your home directory, including procmail.

share|improve this answer
procmail needs to run on the imap server. I have a different server located at another ISP. I want the process running at the other ISP to automatically replicate my email sent to I can't run procmail on I agree with you that this solution works if you can run scripts on the imap server. That's what I used to do before moving to – vy32 Jun 24 '10 at 1:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .