On Feb 21, 2012 6:44 AM, "Grant Edwards" <grant.b.edwards@gmail.com> wrote:
>
> I'm looking to set up something that reads messages from one IMAP
> server/mailbox, filters out the spam, and then writes the filtered
> messages into another IMAP server/mailbox. The source and destination
> servers may or may not be the same, and neither is the machine where
> the filter is running. I'd like the solution to use the IMAP IDLE
> command to avoid the latency and load of constantly setting up SSL
> connections and polling the source server.
>
> It looks like fetchmail -> procmail+spamassassin -> dovecot/deliver
> ought to do what I want.
>
> Is there something simpler and easier that I've overlooked?
>

Okay, I may have misunderstood your needs the first time around (blame it to not having my first cuppa tea of the day).

So, you want to do these steps:
- Pull email from an IMAP account in box A
- Filter it in box B
- Push it to box C

So, the third step is not an LDA.

There are some alternatives, none of them are simple, though. The 'easiest' I think would be:

- have fetchmail (on box B) pull email from box A, and deliver to local maildir (on B) via procmail+SA

- have Dovecot watch the local maildir

- have *another* fetchmail instance pull email from the local Dovecot and push it to an SMTP MTA on box C

You can have multiple fetchmail daemons running at the same time by copying/symlinking the fetchmail initscript and creating a correspondent conf file. I've submitted a patch (that has been accepted into the tree) that allows multiple fetchmail daemons.

Rgds,