On 27 8 2004 at 4:43 pm -0400, Russell Premont wrote:
>I need to setup dot-courier file to get mailman to work properly. There are
>different addresses for the different functions to be performed.
You might be interested in this perl script (a slightly updated version
of one I devised and posted some months ago on this list). Pardon the
copy/paste/email-induced line break mangling.
#!/usr/bin/perl
# courier-to-mailman.pl by Ben Kennedy <[EMAIL PROTECTED]>.
#
# Original version 30 July 2003, which was called as a || delivery instruction
# and returned a list of new delivery instructions for courier to process.
#
# Modified 22 July 2004, to be called as a normal pipe | delivery instruction,
# which will directly inject to mailman or return a message/error code as
appropriate.
#
# # # # # # # # # # #
#
# This is a simple script designed to facilitate dynamic aliasing for
# a dedicated mailing list domain serving any number of Mailman lists.
#
# Usage: configure as a piped delivery instruction for the list server
domain, e.g.:
# @lists.zygoat.ca: |/path/to/courier-to-mailman.pl
#
# And that OUGHT to be it!
#
# Path to local mailman installation:
$MAILMAN = '/usr/local/mailman';
# Path to mailman var data dirs:
$MAILMANVAR = '/usr/local/mailman';
# E-mail of postmaster in case of dire failures:
$POSTMASTER = '[EMAIL PROTECTED]';
# Extract the appropriate mail delivery address from the environment.
# Depending how aliases are configured and expanded locally, we must select
# the proper environment variable to get the string which corresponds to the
# original request address of the incoming message (doggiebox-subscribe).
#
# Usually this will be LOCAL which corresponds to the local part of the
# recipient address, but might also be EXT or EXT2 depending on how the
mail user/alias
# for the list server catch-all is configured. Uncomment the printenv
line below
# and examine its contents after sending a test message, if in doubt.
#
$deliver = $ENV{'LOCAL'};
`printenv >/tmp/mailman-env`;
`id >>/tmp/mailman-env`;
# Here are the known/expected verbs (reserved words in end of list names):
$VERBS = ',post,admin,bounces,confirm
,join,leave,owner,request,subscribe,unsubscribe,';
# Ensure we snagged something suitable from the environment
if ($deliver eq '')
{
print <<EOT;
# $0 - error
# No suitable delivery was found in the environment.
# This is probably due to a configuration error. See source for details.
EOT
exit 64;
}
# split the extension into two parts (e.g. for food-sack-bar):
$deliver =~ m/(.*?)-*(\w+)$/;
$a = $1 || 'unknown'; # will contain the first n-1 sections (food-sack)
$b = $2 || 'request'; # will contain the last section (bar)
if ($a eq '')
{
# there was only one component to begin with, therefore must be list name
$listname = $a;
$verb = 'post';
}
elsif ($VERBS =~ m/,$b,/)
{
# second component was a verb, so first part is the list name
$listname = $a;
$verb = $b;
}
else {
# the whole shebang must be just the list name
$listname = $deliver;
$verb = 'post';
}
# Try to determine whether the requested list actually exists.
# If it doesn't, generate a non-zero code since otherwise the message
# will just get stuck in queue and user will never hear back.
if (! -d "$MAILMANVAR/lists/$listname")
{
print "There is no list by the name of \"$listname\".\n";
exit 64; # Indicates failure to courier
}
else {
# Open a pipe to mailman with the appropriate arguments.
if (!(open (MAILMAN, "|$MAILMAN/mail/mailman $verb $listname")))
{
print "An internal error occurred (can't find mailman); please notify
$POSTMASTER.\n";
exit 64; # Indicate failure
}
# Feed our stdin to mailman.
while (<STDIN>)
{ print MAILMAN; }
close MAILMAN;
# And exit success (should probably get return code from the pipe process...)
exit 0;
}
# The end.
--
Ben Kennedy, chief magician
zygoat creative technical services
613-228-3392 | 1-866-466-4628
http://www.zygoat.ca
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users