Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!veritas!tron From: tron@Veritas.COM (Ronald S. Karr) Newsgroups: comp.mail.misc Subject: Re: Smail 3.1.19 -- Can I get a valid return address? Message-ID: <1991Apr23.012420.5096@Veritas.COM> Date: 23 Apr 91 01:24:20 GMT References: <1991Apr20.194832.21739@coplex.uucp> Organization: VERITAS Software Lines: 35 In article <1991Apr20.194832.21739@coplex.uucp> dean@coplex.uucp (Dean Brooks) writes: > Of course, several uucp sites around me don't correctly put their >entry in the message headers (no "Receieved:" lines). Is there an >environment variable (or a way to do this) that will allow me to use >the "From:" (not the UUCP "From") line with all the name-comments >and other garbage stipped off? I would like to have a "@" type address >if possible rather than a bang path, althought probably not possible. In the general case this is impossible. The reason is that the From: header is not guarranteed to contain exactly one address (see RFC822). However, I suppose that smail could be modified to get the first address. Indeed, it is a reasonable enhancement idea. To do this, you would need to find the from: header in the header list, and then grab out the first address. The following code added to pipe.c:get_pipe_env() should do it: struct list *hp; struct addr *from_addr; char *error; ... for (hp = header; hp; hp = hp->succ) { if (HDREQ("from", hp->text)) break; } if (hp) { (void)process_field((char *)NULL, strchr(hp->text, ':') + 1, (char *)NULL, (char *)NULL, &from_addr, islocal?F_LOCAL:0, &error); if (error == NULL) { ... add from_addr->in_addr into environment ... } } -- tron |-<=>-| ARPAnet: veritas!tron@apple.com tron@veritas.com UUCPnet: {amdahl,apple,pyramid}!veritas!tron