[comp.mail.uucp] small, working mailers

bmw@isgtec.UUCP (Bruce Walker) (07/17/90)

In article <11043@alice.UUCP> ches@alice.UUCP (Bill Cheswick) writes:
> We simply won't use it, for the same reason we don't use sendmail - it
> is much too big.

I'd like to hear what you *do* use (instead of sendmail).  I have just spent
an intensive two weeks cobbling my mail system together, and "I'm mad as hell
and I'm not going to take it anymore!"

I have a TCP'ed bunch of machines with one talking UUCP to the world.

1) I started with vanilla SysVR3 binaries: useless of course.
2) My World-Gateway system (CTIX) has sendmail.  I tried to get that to do
   something, really I did. (sendmail.cf is the machine language of the mailer
   world.)
3) For a long time I used smail2.5 and tried to ignore the fact that I couldn't
   get mail between the TCP'ed hosts and the World-Gateway machine.  You see,
   smail doesn't know anything about ether and expects sendmail to be smart
   enough (if you choose to use it).
4) I am now running smail3.1.  Gosh it's huge.  But it has solved my more
   immediate problems.

So if there is something small, simple and functional out there, I for one
would like to hear about it!
-- 
bmw@isgtec.uucp  [ ..uunet!utai!lsuc!isgtec!bmw ]  Bruce Walker

peter@ficc.ferranti.com (Peter da Silva) (07/20/90)

In article <551@isgtec.UUCP> bmw@isgtec.UUCP (Bruce Walker) writes:
> So if there is something small, simple and functional out there, I for one
> would like to hear about it!

I use smail 2.5 on the ether, by changing smail to call a router program
(included). That program uses a file called "routes" and a bunch of one-line
shell scripts, like so:

========== in defs.h
#define ROUTER "/usr/lib/smail/router" /* Command to route !oid mail */
#define RMAIL(flags,from,sys) "%s %s %s %s",ROUTER,flags,from,sys /* */
========== routes
ris0	opennet
ris1	opennet
ris2	opennet
bridge	opennet
uds1	uucp
uds2	uucp
========== r.opennet
exec rexec //$SYS/usr/lib/mail/execmail -f $FROM $USERS
========== r.uucp
exec uux $FLAGS - "$SYS!rmail $USERS"
========== router.c
#include <stdio.h>
#include <ctype.h>
#include <sys/param.h>

#define LIBDIR "/usr/lib/smail"
#define ROUTEFILE "/usr/lib/smail/routes"
#define DEFROUTE "uucp"

char flags[BUFSIZ], users[NCARGS];
char *from, *sys;
char *prog;

main(ac, av)
int ac;
char **av;
{
	char *flagp = flags;
	char *userp = users;
	FILE *fp;
	char line[BUFSIZ];
	char *lsys, *lroute, *lnl;

	*flagp = 0;
	*userp = 0;

	prog = *av;

	while(ac > 1 && av[1][0] == '-') {
		strcpy(flagp, av[1]);
		strcat(flagp, " ");
		flagp += strlen(flagp);
		av++; ac--;
	}

	if(ac > 1) {
		from = *++av;
		ac--;
	} else
		fail("No sender specified");

	if(ac > 1) {
		sys = *++av;
		ac--;
	} else
		fail("No system specified");

	if(ac <= 1)
		fail("No user specified");

	while(*++av) {
		sprintf(userp, "%s ", *av);
		userp += strlen(userp);
		ac--;
	}

	if(!(fp = fopen(ROUTEFILE, "r"))) {
		perror(ROUTEFILE);
		send(DEFROUTE);
	}

	while(fgets(line, sizeof line, fp)) {
		lsys = line;
		while(isspace(*lsys)) lsys++;
		lroute = lsys;
		while(isgraph(*lroute)) lroute++;
		if(lroute) {
			*lroute++ = 0;
			if(strcmp(sys, lsys) == 0) {
				while(isspace(*lroute)) lroute++;
				lnl = lroute;
				while(isgraph(*lnl)) lnl++;
				*lnl = 0;
				fclose(fp);
				send(lroute);
			}
		}
	}

	fclose(fp);
	send(DEFROUTE);
}

static char work[NCARGS];
send(route)
char *route;
{
	char *workp;

	workp = work;
	sprintf(workp, "USERS=\"%s\" SYS=%s FROM=%s FLAGS=%s ",
		users, sys, from, flags);
	workp += strlen(workp);
	sprintf(workp, "%s/r.%s ", LIBDIR, route);
	workp += strlen(workp);
	sprintf(workp, "%s %s %s %s", flags, from, sys, users);
	fprintf(stderr, "+ %s\n", work);
	execl("/bin/sh", "sh", "-c", work, (char *)0);
}

fail(message)
char *message;
{
	fprintf(stderr, "%s: %s\n", prog, message);
	exit(1);
}
-- 
Peter da Silva.   `-_-'
+1 713 274 5180.
<peter@ficc.ferranti.com>