coding, hacking, startups, computer security, technology and more

Converting Vpopmail Aliases to Ezmlm Mailing Lists

Ezmlm (EaZy Mailing List Manager) is a powerful mailing list solution for qmail. It also works well with Inter7's VPOPMAIL too. From a standard ports install (/usr/ports/mail/vpopmail/) , vpopmail will live in /usr/local/vpopmail/ on a FreeBSD system. Here's a small tcsh based script which can be used to create mailing lists for domains. It takes two parameters the LISTNAME(@domain.dom) and the domain name itself. The script checks for the existance of an existing dot qmail file. If one exists the contents will be subscribed to the mailing list (NOTE: This script does NOT cater for "| forward" style lines!). Anyway.. this may be useful to some people..

#!/bin/tcsh -f

Make a mailing list for a vpopmail hosted domain


Author: jbw

WWW: www.jerrywalsh.org


set LISTNAME="$1" set DOMAIN="$2" set BASEDIR="/usr/local/vpopmail/domains/$DOMAIN/" set LISTFILE="$BASEDIR/.qmail-$LISTNAME" set LISTDIR="$BASEDIR/lists/$LISTNAME/"

if ( "$LISTNAME" == "" ) then echo You must specify a list name exit 1 endif

if ( "$DOMAIN" == "" ) then echo You must supply a domain name exit 2 endif

if ( ! -d "$BASEDIR" ) then echo The domain $DOMAIN is not hosted by VPOPMAIL.. add the domain first. exit 3 endif

if ( ! -d "$LISTDIR") then

if ( -e "$LISTFILE" ) then echo Migrating the following emails to the $LISTNAME mailing list... cat "$LISTFILE" && \ mv "$LISTFILE" "$LISTFILE_" echo ----------------------------------------------------------------- endif

/usr/local/bin/ezmlm-make $LISTDIR $LISTFILE $LISTNAME $DOMAIN && \ chown -R vpopmail:vchkpw $LISTDIR

if ( -e "$LISTFILE_" ) then tr -d '&' < "$LISTFILE_" | /usr/local/bin/ezmlm-sub $LISTDIR && \ rm "$LISTFILE_" endif else echo The $LISTNAME@$DOMAIN mailing list already exists, since the following dir exists: echo $LISTDIR endif ```