[Mailman-Users] Re: New user comments

David Champion dgc at uchicago.edu
Fri Jun 16 02:53:31 CEST 2000


On 2000.06.15, in <Pine.LNX.4.04.10006151706160.28207-100000 at archer.kd-dev.com>,
	"Derek Simkowiak" <dereks at kd-dev.com> wrote:
> ->
> -> Actually, as a sendmail user, you don't have to touch /etc/aliases either.
>
> 	Can you describe how to do this?  It would be nice if I didn't

I posted one solution to this a couple of days ago.
	Subject: Re: [Mailman-Users] user unknown
	Date: Tue, 13 Jun 2000 05:37:33 -0500
	Message-ID: <20000613053733.N1357 at smack.uchicago.edu>

That script needs at least two edits I can think of.  This revised copy
should do it, although (I admit) I haven't tested the changes.

-- 
 -D.	dgc at uchicago.edu	NSIT	University of Chicago
-------------- next part --------------
#!/opt/bin/perl
##
## Sendmail mailer for Mailman
##

## Simulates these aliases:
## testlist:                "|/opt/pkgs/mailman/mail/wrapper post testlist"
## testlist-admin:          "|/opt/pkgs/mailman/mail/wrapper mailowner testlist"
## testlist-request:        "|/opt/pkgs/mailman/mail/wrapper mailcmd testlist"
## owner-testlist:          testlist-admin
## testlist-owner:          testlist-admin

use FileHandle;

$MMWRAPPER = "/opt/pkgs/mailman/mail/wrapper";
$MMLISTDIR = "/opt/pkgs/mailman/lists";
$SENDMAIL = "/usr/lib/sendmail -t -oem -oi";
$VERSION = '$Id: mm-handler,v 1.3 2000/06/16 00:47:57 dgc Exp $';

$BOUNDARY = sprintf("%08x-%d", time, time % $$);

## Stupid non-standard rejection letter
sub mail_error {
	my ($in, $to, $orig_to, $server, $reason) = @_;
	my $sendmail;

	$sendmail = new FileHandle "|$SENDMAIL";
	#$sendmail = new FileHandle ">/tmp/mm-$$";
	if (!defined($sendmail)) {
		print STDERR "$0: cannot exec \"$SENDMAIL\"\n";
		exit (-1);
	}

	$sendmail->print ("From: MAILER-DAEMON\@$server
To: $to
Subject: Returned mail: List unknown
Mime-Version: 1.0
Content-type: multipart/mixed; boundary=\"$BOUNDARY\"
Content-Disposition: inline

--$BOUNDARY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Your mail for $orig_to could not be sent:
	$reason
Your original mail follows:

--$BOUNDARY
Content-Type: message/rfc822
Content-Disposition: inline

");

	while ($_ = <$in>) {
		$sendmail->print ($_);
	}

	$sendmail->print ("\n");
	$sendmail->print ("--$BOUNDARY--\n");

	close($sendmail);
}

BEGIN: {
	$sender = undef;
	while ($_ = shift(@ARGV)) {
		$sender = $ARGV[0] if (/^-r$/);
		if (/^--$/) {
			$to = $ARGV[0];
			$server = $ARGV[1];
		}
	}

#	print STDERR "to: $to\n";
#	print STDERR "sender: $sender\n";
#	print STDERR "server: $server\n";

	if (! -f "$MMLISTDIR/$to/config.db") {
		$LIST = $to;
		$CMD = "post";
	} elsif ($to =~ /(.*)-admin/
			|| $to =~ /(.*)-owner/
			|| $to =~ /owner-(.*)/) {
		$LIST = $1;
		$CMD = "mailowner";
	} elsif ($to =~ /(.*)-request/) {
		$LIST = $1;
		$CMD = "mailcmd";
	} else {
		mail_error(\*STDIN, $sender, $to, $server, "no list named $LIST is known to this server");
		exit 0;
	}

	$wrapper = new FileHandle "|$MMWRAPPER $CMD $LIST";
	if (!defined($wrapper)) {
		## Defer?
		print STDERR "$0: cannot exec \"$MMWRAPPER $CMD $LIST\": deferring\n";
		exit (-1);
	}

	$wrapper->print ("X-Handler: $VERSION\n");
	while (<STDIN>) {
		$wrapper->print ($_);
	}
	close($wrapper);

	exit($?);
}


More information about the Mailman-Users mailing list