stephen@dcl-cs.UUCP (Stephen J. Muir) (08/07/85)
I wanted to maintain large mailing lists using "sendmail". I only knew of two ways of doing this: - set up a login name with a ".forward" file OR - set up aliases in "/usr/lib/aliases" I didn't want to set up login names and "/usr/lib/aliases" would have become too unwieldy, so I wrote another program to do it and this follows. If there is another way to do it, or there is a better program about, please mail me. Installation: Compile the following program and put in "/usr/bin/maillistfile". Create a file containing all the mailboxes in the list, one per line. Put an entry of the following form in "/usr/lib/aliases": fire-lovers:"|maillistfile /usr/gurus/elton/fire-lovers". ----------------------------------- cut here ---------------------------------- #!/bin/sh echo 'Start of pack.out, part 01 of 01:' echo 'x - maillistfile.c' sed 's/^X//' > maillistfile.c << '/' X/* Written by Stephen J. Muir, Computing Dept., Lancaster University */ X X# include <sys/types.h> X# include <sys/stat.h> X# include <sys/file.h> X# include <stdio.h> X Xextern char *malloc (); X Xchar *mailer = "/usr/lib/sendmail", **newargv, **nargvp; X Xint fd, count; X Xstruct stat stat; X Xmain (argc, argv, envp) X char *argv [], *envp []; X { register char *cp, *recipients; X if (argc != 2) X { fprintf (stderr, "usage: maillistfile file\n"); X exit (1); X } X if ((fd = open (argv [1], O_RDONLY, 0)) == -1) X { perror (argv [1]); X exit (1); X } X setuid (getuid ()); X (void)fstat (fd, &stat); X if ((stat.st_mode & S_IFMT) != S_IFREG) X { fprintf (stderr, "%s: not a regular file", argv [1]); X exit (1); X } X if ((recipients = malloc (stat.st_size)) == 0) X { fprintf (stderr, "Out of memory.\n"); X exit (1); X } X if (read (fd, recipients, stat.st_size) != stat.st_size) X { perror ("read()"); X exit (1); X } X for (cp = recipients; cp < recipients + stat.st_size; ++cp) X if (*cp == '\0') X { fprintf (stderr, "%s: null byte in file\n", argv [1]); X exit (1); X } X else if (*cp == '\n') X { *cp = '\0'; X ++count; X } X if (*--cp != '\0') X { fprintf (stderr, "%s: incomplete last line\n", argv [1]); X exit (1); X } X if (count == 0) X { fprintf (stderr, "%s: empty list\n", argv [1]); X exit (1); X } X if ((nargvp = X newargv = X (char **)malloc ((sizeof (char **)) * (count + 3)) X ) == 0 X ) X { fprintf (stderr, "Out of memory.\n"); X exit (1); X } X *nargvp++ = "maillist"; X *nargvp++ = "-oMslist-channel"; X cp = recipients; X while (count--) X { *nargvp++ = cp; X while (*cp++ != '\0'); X } X *nargvp++ = 0; X execve (mailer, newargv, envp); X perror (mailer); X exit (1); X } / echo 'Part 01 of pack.out complete.' exit -- UUCP: ...!seismo!mcvax!ukc!dcl-cs!stephen DARPA: stephen%lancs.comp@ucl-cs | Post: University of Lancaster, JANET: stephen@uk.ac.lancs.comp | Department of Computing, Phone: +44 524 65201 Ext. 4599 | Bailrigg, Lancaster, UK. Project:Alvey ECLIPSE Distribution | LA1 4YR
stephen@dcl-cs.UUCP (Stephen J. Muir) (08/09/85)
I was informed by booker@arpa.nrl-aic that this facility is already built into sendmail. The format is as follows: list1::include:/usr/list1 I wish the documents for sendmail were as up to date as the program! -- UUCP: ...!seismo!mcvax!ukc!dcl-cs!stephen DARPA: stephen%lancs.comp@ucl-cs | Post: University of Lancaster, JANET: stephen@uk.ac.lancs.comp | Department of Computing, Phone: +44 524 65201 Ext. 4599 | Bailrigg, Lancaster, UK. Project:Alvey ECLIPSE Distribution | LA1 4YR
gregc@ucsfcgl.UUCP (Greg Couch%CGL) (08/10/85)
There is a documented feature of sendmail, that most sendmail configuration files defeat, which allows the alias list to be read in from a file. In /usr/lib/aliases put: fire-lovers: :include:/usr/gurus/elton/fire-lovers And in /usr/lib/sendmail.cf, put the following lines just after the line that starts with S3, i.e.: S3 # support :include: directive in alias file R:include:$* $@:include:$1 ----- Greg Couch ucbvax!ucsfcgl!gregc gregc@ucsf-cgl.ARPA
mendell@utai.UUCP (Mark Mendell) (08/12/85)
How about the (almost undocumented) :include: keyword in /usr/lib/aliases. You can put "firelovers: :include: /usr/fireloverNames" into /usr/lib/aliases, and sendmail will use the contents of the file to expand the alias. Have fun trying to find the documentation! -- Mark Mendell Computer Systems Research Institute University of Toronto Usenet: {linus, ihnp4, allegra, decvax, floyd}!utcsri!mendell CSNET: mendell@Toronto ARPA: mendell%Toronto@CSNet-Relay
louie@umd5.UUCP (08/20/85)
In article <654@utai.UUCP> mendell@utai.UUCP (Mark Mendell) writes: >How about the (almost undocumented) :include: keyword in /usr/lib/aliases. >You can put "firelovers: :include: /usr/fireloverNames" into /usr/lib/aliases, >and sendmail will use the contents of the file to expand the alias. >Have fun trying to find the documentation! >-- >Mark Mendell Well, if you look at the doc directory in /usr/src/usr.lib/sendmail, in "SENDMAIL - An Internetwork Mail Router", the :include: feature is described in section 3.3 "Aliasing, Forwarding, Inclusion". RTFM. -- Louis A. Mamakos WA3YMH University of Maryland, Computer Science Center Internet: louie@trantor.arpa UUCP: {seismo!umcp-cs, ihnp4!rlgvax}!cvl!umd5!louie