# How to filter mail from one mailbox to an entire domain. # Copyright Robin Smidsrød 13. May 1999 # # Check http://www.smidsrod.no/ for recent changes. # Ok, so now you've setup that domain, and all mail for that domain is delivered to your mailbox at the ISP. Of course your ISP is using QMail as it's MTA, and inserts 'Delivered-To:'-lines in the headers of your emails. Let's setup some variables for the examples: Your mail-domain: firm.com ISP MTA: mail.isp.com ISP Username: firm Local MTA: server.local.com Local Username: servmail Locally, you need to be running a Unix system, and have a working procmail installation. You also must have some sort of program which downloads the emails from your ISP and injects them into you local MTA. Fetchmail does this excellent. NB: If the user is not defined on the local system, the email will bounce. If you need to setup eg post@firm.com, you need to create the user, or make an alias in your MTA, so it get's delivered to the right user(s) on your system. For software, check http://freshmeat.net/ or http://linuxstart.com/, they usually carry the latest versions available. This is the magical procmail recipe to filter the mails to your own users, it should be in servmail's homedirectory: <------------- .procmailrc ------------> :0 HDc * ^Domain-Mail-Split: server$ /dev/null # Filter mail for entire domain :0 E * ^Delivered-To: firm-\/[^@]+ * ^Delivered-To: firm-.*\@firm.com { :0 f * | formail -a "Domain-Mail-Split: server" :0 * ! $MATCH } <------------- .procmailrc ------------>