How to get and process mails from multiple accounts for one user on MacOSX

Introduction

This is a "single user" station. But along the time, I got various email accounts that I uses for various purpose.

I have been using Eudora at home and Entourage (previously Outlook) at works for years. They were usefull tools for handling multiple accounts, filtering and such. Entourage is more "User friendly". Eutora is light AND powefull. It has one limitation for me, not being able to have different port for different pop servers (I recently learned a trick to do it, but I am still in the process of changing).

For the following explanations, my local login is "fgranger" and my mail accounts will be "toto@altern.org", "toto@laposte.net" and "tata@laposte.net".

Installing fetchmail

It is already available, so you just need to configure it. It will grab you mails and transfer them to a software wich will dispatch them locally. By default it will try to activate sendmail and if this fail, procmail.
In your folder, you need to create a file named ".fetchmailrc". To do this, use pico.

This file contains:

#set syslog
set daemon 600
set logfile /Users/fgranger/Mail/fetchmail.log
set postmaster "fgranger"
set no bouncemail
set invisible
set showdots

defaults proto pop3 uidl
# remove if invisible
        tracepolls
        keep
        mda "/usr/bin/procmail -d %T"
        no rewrite

poll pop.laposte.net
        user toto there with pass password is fgranger here 
        user tata there with pass password is fgranger here 

poll altern.org interval 3
        user pbarn there with pass password is fgranger here

I did not activated syslog yet
I have fetxhmail running as a daemon evry 10 minutes
I keep a log file of it activities. When I double click this file in the Finder, it shows in Condole and this display updates dynamically.
I define some server defaults : defaults proto pop3 uidl
and some user default : keep mda "/usr/bin/procmail -d %T" no rewrite This direct invocation of procmail should not be needed if sendmail was never activated. But anyway, it makes things clearer (python coders say "Explicit is better than implicit").

Then for each server, I give it own parameters, then each account parameters.

Installing procmail

It is already available, so you just need to configure it. If it does not exist yet, you have to create the /var/mail/fgranger file. Just do :

touch /var/mail/fgranger

You must also create the Mail directory we will use in some rules.

cd this puts you back in your home directory
mkdir Mail

In your folder, you need to create a file named ".procmailrc". To do this, use pico.

This file contains:

SHELL=/bin/sh
DEFAULT=/var/mail/fgranger
LOGFILE=/Users/fgranger/procmail.log
LOGABSTRACT=all
MONTHFOLDER=`date +%y%m%d`

:0Wic
* ? test ! -d /Users/fgranger/Mail/$MONTHFOLDER
| mkdir /User/fgranger/Mail/$MONTFOLDER

:0c
/Users/fgranger/Mail/${MONTHFOLDER}/.

:0 fw
| python /Volumes/OS99/spambayes/hammiefilter.py

:0:
$DEFAULT

First some variables definitions.
The MONTHFOLDER is a trick I got from the net, I converted it to a day folder.
First rule is to create the daily folder.
Second rule is to keep a copy of each incoming mail in separate files in the dayly folder. It is kept in separate files because the path ends with "/.".
Third rule activate Spambayes scoring on each message "f" for filter "w" for waiting that it finishes.
Last rules store all mails in the "/var/mail/fgranger" file with a lock to prevent concurent access.

installing GNUMail

Just download the ".dmg". Drag & drop the unique file from the disque inside the Application folder.

Setup:

Lauch GNUmail by double clicking it.
The key thing is in the Receiving preference. In the "Incoming mail server" area, click on the blue "+". In the "Server type" pop-up choose UNIX. Then click on the UNIX tab. you should already have "/var/mail/fgranger".

Using spambayes

In GNUMail you create a filter:
GNUMail menu
Preferences...
Filtering (the right most icon)
With the blue plus, you create a new rule. You name it. In the Criteria area, you click on the To pop up and go to Expert...
There, you enter the "X-Spambayes-Classification" text in the bottom of the screen and click OK. In the middle pop up menu, you keep "Contains", and in the right field, you enter "spam". Et voilˆ.

Using MacSOUP

The latest version of MacSOUP allow multiple accounts. It installation is really straight forward.

Other possibilities.