[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More zmailer/mailman integration



I have just completed reworking the code that Jeff Warnica posted for 
integrating mailman and zmailer. This code basically extends his original 
code to better handle virtual domains.

The basic idea is that all lists get created with the domain name prefixed 
to the listname. For example, one of my virtual domains is moac.org, so I 
have created moac-climbing, moac-kayak, moac-downhill, and moac-xcountry 
lists. Users are able to mail to both moac-climbing@moac.org or 
climbing@moac.org. Even addresses like climbing-admin@moac.org are handled 
correctly.

See the comments about configuring mailman.

The following code is placed in the alias.cf file just after the zmailer 
lists are processed. In my alias.cf it is around line 530.

###################
#
# START mailman integration
#
###################

if [ -n "$MAILMAN_ROOT" ] ; then
    local listname root_domain_name mailman_todo

    # Which domain is this message intended for?
    tsift "$host" in
        (.*)@.*\.([^\.]*)\.([^\.]*)
            root_domain_name="\2"
            ;;
        (.*)@([^\.]*)\.([^\.]*)
            root_domain_name="\2"
            ;;
    tfist

    # Check to see if we have a list pseudo mail address
    #
    # Some of these may not be valid. Original list from Jeff Warnica.
    # The -admin, -owner and -request updated for mailman 2.0.5.
    listname=$lcuser
    mailman_todo='post'
    ssift "$lcuser" in
        (.+)-owner
            listname="\1"
            mailman_todo="mailowner"
            ;;
        (.+)-admin
            listname="\1"
            mailman_todo="mailowner"
            ;;
        (.+)-bounces
            listname="\1"
            mailman_todo="bounces"
            ;;
        (.+)-confirm
            listname="\1"
            mailman_todo="confirm"
            ;;
        (.+)-join
            listname="\1"
            mailman_todo="join"
            ;;
        (.+)-leave
            listname="\1"
            mailman_todo="leave"
            ;;
        (.+)-request
            listname="\1"
            mailman_todo="mailcmd"
            ;;
        (.+)-subscribe
            listname="\1"
            mailman_todo="subscribe"
            ;;
        (.+)-unsubscribe
            listname="\1"
            mailman_todo="unsubscribe"
            ;;
    tfiss

    # General process here is to check if the receipent is a list
    # with the domain name prepended to the receipent name. If so,
    # the $listname variable is changed accordingly.
    #
    # Example: Mailman list is officially moac-climbing. Mail comes in as
    # climbing@moac.org. The variable $root_domain_name is prepended and
    # moac-climbing is found as a list.
    #
    # Note: Mailman lists need to be configured to allow the short name
    # to be used. Under each list the "alias names" in privacy options
    # needs to set. In the above example, I use 'climbing@' for the
    # regexp.
    #
    if [ -d "$MAILMAN_ROOT/lists/$root_domain_name-$listname" ] ; then
        listname="$root_domain_name-$listname"
    fi

    if [ -d "$MAILMAN_ROOT/lists/$listname" ] ; then
        nattr=$(newattribute $attr privilege "0")
        $(zapDSNnotify $nattr delivered "$sender" "$lcuser$domain")
        a=(((local pipe.$listname "|$MAILMAN_ROOT/mail/wrapper 
$mailman_todo $li
stname" $nattr)))
        postzapDSNnotify a +
        return $a
    fi
fi

###################
#
# END mailman integration
#
###################


--
Gerard Hickey <hickey@kernelrom.com>/Jabber: unixgeek@jabber.kernelrom.com
-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to majordomo@nic.funet.fi