#### 3.12.8 Mailing list implementation ¶

This subsection explains how to implement mailing lists in `mda` using the ‘`prog`’ mailbox scheme.

Delivery to the ‘`prog`’ mailbox results in invoking the specified command with the given arguments and passing the message to its standard input. There are two ways to specify a ‘`prog`’ mailbox:

prog://program?args

  Here, program is the absolute pathname of the program binary, and args are its arguments, separated by ‘`&`’ signs.

|program args

  In this notation, args are command line arguments separated by white space.

In both cases, args do not include `argv[0]`.

The ‘`prog`’ mailbox can be used to implement mailing lists.

For example, suppose that the `mda` configuration contains:

    auth {
      authorization (sql, system);
      authentication (generic, system);
    }

    sql {
      interface mysql;
      db mail;
      getpwnam "SELECT user as name, mailbox, "
               "'x' as passwd, 500 as uid, 2 as gid, "
               "'/nonexistent' as dir, '/sbin/nologin' as shell "
               "FROM userdb "
               "WHERE user='${user}'";
    }

Then, the following entries in the ‘`userdb`’ table implement the mailman@yourdomain mailing list:

    mysql> select * from userdb;
    +---------------------+---------------------------------------+
    | user                | mailbox                               |
    +---------------------+---------------------------------------+
    | mailman             | |/usr/bin/mailman post mailman        |
    | mailman-admin       | |/usr/bin/mailman admin mailman       |
    | mailman-bounces     | |/usr/bin/mailman bounces mailman     |
    | mailman-confirm     | |/usr/bin/mailman confirm mailman     |
    | mailman-join        | |/usr/bin/mailman join mailman        |
    | mailman-leave       | |/usr/bin/mailman leave mailman       |
    | mailman-owner       | |/usr/bin/mailman owner mailman       |
    | mailman-request     | |/usr/bin/mailman request mailman     |
    | mailman-subscribe   | |/usr/bin/mailman subscribe mailman   |
    | mailman-unsubscribe | |/usr/bin/mailman unsubscribe mailman |
    +---------------------+---------------------------------------+