The Mailgate v2 configuration language I have decided to overhaul mailgate in a major way. Here's the proposed new configuration syntax. Note: Parts of this syntax are shamelessly stolen from Eric S Raymond's fetchmail! 1) setting global options mboxdir is 'dir name'|None # dir of mbox files savedir is 'dir name'|None # dir of saved mboxes errordir is 'dir name' # dir of saved messages in case of delivery errors Postmaster is 'address' # Postmaster's email address 2) getting mail from a POP account input from POP3 | APOP at 'mail server' user 'username' password 'password' [keep] # keep mail in POP account [for 'domain'] # forward mails to this domain 3) getting mail from an mbox file input from mbox in 'mbox file' [for 'domain'] 4) sending mail with SMTP output with SMTP to 'mail server' 5) sending mail to an mbox file output to mbox 'mbox file' # always appends 6) specifying redirections redirect all to 'recipient' [and 'recipient']... , 'pattern' to 'recipient' [and 'recipient']... , header 'field name' with 'pattern' to ... alternative: redirect recipient '^bb-exec@dware.ch$' to prog '/usr/local/bin/mail-exec', recipient 'mhc@dware.ch' to mbox 'dware.mbx' from '@spammer.com$' to mbox '/dev/null' sender 'linux-kernel' to SMTP 'lk' domain 'dware.ch' to SMTP 'mail.intern.dware.ch' 7) specifying a schedule schedule days Mon-Fri, hours 7-21, minutes 10, 30, 50 schedule days Sat, Sun hours 10, 14, 18 minutes 0 if no schedule is given, mailgate just runs once. 8) executing a batch . # that's right: a single dot! 9) ignored tokens: and, at, by, from, in, is, to, with, ':' This whole thing will use the Python module tokenize to parse the config file. Examples: # ex mailgate.py errordir is '.' Postmaster is 'Postmaster@dware.ch' input POP3 from 'pop.spectraweb.ch' user 'dware1' with password 'secret' for domain 'dware.ch' redirect '^dware1?@spectraweb.ch$' to Postmaster, '^root@dwaf01' to 'bb', 'crypto-gram|livid|linux|opendvd|ovd-dev' to 'bb', '@golem\.de$' to 'bb' and 'aw', '^house66' to 'bb' 'mba' 'aw' 'bud', '^bb-priv' to 'beat.bolli@earthling.net' # etc... output with SMTP to 'mail.intern.dware.ch'. input POP3 from 'pop.bluewin.ch' user 'beat.bolli' password 'blabla' redirect all to 'bb' output with SMTP to 'mail' option u. # ex POPMbox.py mboxdir is '\\DWAS21\DO\Daten\PM\Mail_in\POP2Mbox' input POP3 form 'mail.intern.dware.ch' user 'mhc' password 'secret2' output to mbox 'mhc.mbx'. input POP3 form 'mail.intern.dware.ch' user 'info' password 'secret3' output to mbox 'info.mbx'. # ex MboxSMTP.py mboxdir is '\\DWAS21\DO\Daten\PM\Mail_out\Mbox2SMTP' savedir is '\\DWAS21\DO\Daten\PM\Mail_out\Mbox2SMTP\save' input from mbox 'dware.mbx' domain 'dware.ch' output with SMTP to 'mail.intern.dware.ch'.