How can I replicate incoming imap mail to another folder?

2

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?

vy32

Posted 2010-02-15T17:44:42.520

Reputation: 2 715

1+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 – 2010-06-12T11:04:42.183

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 Mail.app's built-in search, which really rocks. – vy32 – 2010-06-18T19:48:05.307

Can Mobile Me forward a copy of all incoming mail to another address? – Craig – 2010-06-19T00:07:03.353

Not sure, but I want l the mail to stay on same service. – vy32 – 2010-06-21T10:26:30.697

Answers

1

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.

Peter Murray

Posted 2010-02-15T17:44:42.520

Reputation: 827

Will fetchmail copy to a different IMAP box? – vy32 – 2010-06-21T10:34:56.263

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 – 2010-06-21T11:46:39.553

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 – 2010-06-24T01:30:33.560

Unfortunately, no -- I don't have anything ready-made. It is possible in theory, but I haven't done it myself. – Peter Murray – 2010-06-25T01:30:08.150

0

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)

paullb

Posted 2010-02-15T17:44:42.520

Reputation: 121

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 – 2010-06-24T01:31:18.473

-1

You could use Thunderbird and its Message Filters

Dominik

Posted 2010-02-15T17:44:42.520

Reputation: 767

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 – 2010-02-17T13:22:35.447

-1

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.

afrazier

Posted 2010-02-15T17:44:42.520

Reputation: 21 316

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 – 2010-04-29T01:38:10.943

-1

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

Ignacio Vazquez-Abrams

Posted 2010-02-15T17:44:42.520

Reputation: 100 516

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 me.com. I can't run procmail on me.com.

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 me.com. – vy32 – 2010-06-24T01:32:40.920