Updated 2016-09-20 16:18:00 by RKzn

Postfix (see: postfix.org) is a very good unix MTA (mail transport agent) ... mailserver :)

There was a book review with a rosy view of the Postfix world at... unixreview.com but as of 2016 this is a dead link

How to use tcl with Postfix - 20040608 CMcC

I had an application called elink, which needed to process incoming email under tcl.

First: Add a new Postfix transport to /etc/postfix/master.cf:
    elink     unix  -       n       n       -       -       pipe flags=R user=elink:mail argv=/usr/bin/tclsh /home/elink.tcl $sender $nexthop $user $extension

This mail transport causes Postfix to open a unix pipe with a tclsh running the file /home/elink.tcl for each incoming email which uses the elink transport. pipe [1] is a Postfix program which launches the tclsh with the appropriate perms and the appropriate mail values substituted on the command line for Postfix's variables ($user etc.)

Next: you have to specify when the transport (elink in this example) it so be used to deliver email.

The details are hazy, but IIRC you specify which addresses or domains are to be transported by the specified transport in /etc/postfix/transport like these examples:
    [email protected] transport:nexthop
    .domain transport:nexthop

Of course, the precise way you specify which emails use the tcl based transport depends on what you're trying to achieve.

You'll have to at least read Postfix documentation to be able to cobble together a mailing list manager in tcl.