procmail
[Top] [All Lists]

Re: Simple Private Mailing List

1996-04-16 23:05:52
    1)  Is it possible to write a recipe condition which will determine
whether the sender of a message is contained in this list, so that only
list members may invoke the list code?

You should think very carefully before doing this to make sure it is
really what you want.  Many users have a vast number of different
addresses (I have about 80 which I might conceivably mail from).  Do you
want to list all of these addresses, or do you want to force people to
mail from the address the mail is to be delivered to?  The latter isn't
always possible.

    2)  Once a message has been passed and formail has massaged it
appropriately, what is the most efficient way to forward it to
everybody?  Presently I have this (within a nesting block):
    :0 fw
    | formail -A ...         # whole bunch of formail stuff
    :0 c
    archive.file             # save a copy of the message in the archive
    :0 a
    ! `cat $HOME/userlist`   # forward to all list members

That's pretty much what I do with my list, except for the last recipe.

Is there a practical upper limit as to how many addresses
$HOME/userlist may contain?

Theoretically the address can be as long as the shell allows a command
line to be (which might be as small as 255 bytes on broken machines).
I instead feed the mail into a perl script like the one after my
.signature.  This breaks up the list into groups of eight names and
mails off the article to each group in turn.  This tends to help my
sendmail behave better (though it might not help all sendmails).

The file format for the members is one RFC822 address format per line.
I consider this a little friendlier than simply comma-separating a whole
heap of addresses, which is hell to maintain.

YMMV.

-- 
Tim Pickett                                     
tlm(_at_)yoyo(_dot_)cc(_dot_)monash(_dot_)edu(_dot_)au
I have a fin fetish.                           
tbp(_at_)molly(_dot_)cs(_dot_)monash(_dot_)edu(_dot_)au


#!/usr/local/gnu/bin/perl

# Distribute mail to all the members.

$PER = 8;
@SENDMAIL = ("/usr/lib/sendmail", "-oi");
$MEMBERS = $ENV{"HOME"} . "/lib/arielholics/members";

# Save message in a string.
undef $/;
$message = <>;
$/ = "\n";

open MEMBERS or die "Can't read member list!";

while (1)
{
  @address = ();
  last if eof (MEMBERS);
  while (<MEMBERS>)
  {
    chop;
    push (@address, $_);
    last if $#address == $PER - 1;
  }
  warn ("Can't send mail to @address\n")
    if &sendmail ($message, @address);
}

sub sendmail
{
  my ($text, @address) = @_;
  $chpid = open (MAILTEXT, "|-");
  if (!defined $chpid)
  {
    warn ("Can't fork");
  }
  if ($chpid == 0)
  {
    exec (@SENDMAIL, @address);
    die ("Can't exec");
  }
  print MAILTEXT $text;
  close MAILTEXT;
  $?;  # return value.
}

<Prev in Thread] Current Thread [Next in Thread>