I am setting up a small email server on a Debian machine, which needs to pick up mail from a variety of POP servers and figure out who to send it to from the address, but I'm not clear what software will do what I need, although it seems like a very simple question!
For example, I have 2 users, Alice and Bob.
Any email to alice@domain.example.com ([email protected] etc) should go to Alice, all other mail to domain.example.com should go to Bob.
Any email to [email protected] should go to Bob, and [email protected] should go to Alice
Anything to *@bobs.place.com should go to Bob
And so on...
The idea is to pull together a load of mail addresses that have built up over the years and present them all as a single mailbox for Bob and another one for Alice.
I'm expecting something like Postfix + Dovecot + Amavis + Spamassassin + Squirrelmail to fit the bill, but I'm not sure where the above comes in, can Postfix deal with it as a set of defined regular expressions, or is it a job for Amavis, or something else entirely? Do I need fetchmail in this mix, or is its role now included in one of the other components above.
I think of it as content-filtering, but everything I read about content-filtering is focussed on detecting spam rather than routing email.
Perdition is excellent for this kind of wizardry.
You can feed the mails into Postfix from fetchmail and then configure Postfix with its aliases and virtual maps to drop them into the correct accounts or forward them further.
Dovecot could be used to store and access the mails afterwards via IMAP, but this another problem.
Amavis and Spamassasin are not part of this - Amavis is a virus scanner interface and Spamassasin a spam filter. Both should be part of your installation, but they don't contribute to the problem you outlined.
I have found what seems to be the simplest way to do it, hope this helps someone else...
I've settled on fetchmail+postfix to start with, as once I found out about fetchmail multidrop, I had the right terminology to get started!
In my /etc/fetchmailrc I have multiple sections like this, one for each ISP who I still use for email
This picks up the mail from the ISP and fires it into my local postfix.
The 'smtpaddress' bit was the hardest to find, it looks like not many people write about using it. Without that (eventually found hiding in plain view in the fetchmail docs!), all mails from all ISPs were having domains replaced by localhost so I couldn't do different routing from different ISPs. For example, on one domain I want to catch all mails for spam processing, on another I can ruthlessly discard any unwanted addresses.
Then in my postfix configuration, I create /etc/postfix/virtual-regexp with lines like
Then run
to create /etc/postfix/virtual-regexp.db and finally add the following line to /etc/postfix/main.cf
Finally, restart/reload postfix to use the new configuration.
And when (not if!) your carefully crafted regex all goes wrong, make good use of
which replies with the destination routing from your regex file. Actually, the sensible administrator will use that to test the settings before applying them, but I didn't find out about it until I'd had problems!
The above works for me, mail routes where it should, and fires on to dovecot for IMAP delivery, hope it helps someone else too!