[Mailman-Users] user unknown

David Champion dgc at uchicago.edu
Tue Jun 13 12:37:33 CEST 2000


On 2000.06.13, in <18578.960881804 at kanga.nu>,
	"J C Lawrence" <claw at kanga.nu> wrote:
> 
> It is worth noting that instructions are available for some MTAs
> (like Exim) such that no aliases ever need be added.  The MTA
> auto-recognises the existance of all lists due to the fact taht the
> customisations know about how Mailman works.

Someone's probably already been all over this, but I didn't see it in a
quick sweep of the web page....

This comment set me to thinking, and I wrote a sendmail mailer to
obviate my aliases.  I configured this in /etc/mail/sendmail.cf:
	Mmailman,	P=/etc/mail/mm-handler, F=nrDFMehmu, S=10, R=20/40,
			A=mm-handler -- $u listserver.uchicago.edu
and this in /etc/mail/mailertable:
	listserver.uchicago.edu	mailman:listserver.uchicago.edu

After installing /etc/mail/mm-handler, I rebuilt mailertable, restarted
sendmail, and everything seems to work fine without aliases.  I wonder
whether this would be interesting or useful for anyone.  It was more of
an academic exercise for me, since we have scripts that make manual
alias creation unnecessary, but it certainly makes expiry of addresses
for dead lists easier.

I apologize if its being written in perl is offensive to anyone.  :)

-- 
 -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.2 2000/06/13 10:19:37 milo 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);
}

$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 ($to =~ /(.*)-admin/ || $to =~ /(.*)-owner/ || $to =~ /owner-(.*)/) {
	$LIST = $1;
	$CMD = "mailowner";
} elsif ($to =~ /(.*)-request/) {
	$LIST = $1;
	$CMD = "mailcmd";
} else {
	$LIST = $to;
	$CMD = "post";
}

if (! -f "$MMLISTDIR/$LIST/config.db") {
	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);


More information about the Mailman-Users mailing list