Path: utzoo!yunexus!ists!jarvis.csri.toronto.edu!mailrus!uflorida!novavax!twwells!bill From: bill@twwells.com (T. William Wells) Newsgroups: comp.mail.uucp Subject: Re: Smail, Aliases & Programs Keywords: smail alias Message-ID: <1989Nov17.232837.10751@twwells.com> Date: 17 Nov 89 23:28:37 GMT Article-I.D.: twwells.1989Nov17.232837.10751 References: <590@piglet.vision.UUCP> <974@becker.UUCP> <254733A5.10634@ateng.com> <13074@s.ms.uky.edu> <254CCBB1.19467@ateng.com> <1989Nov2.200712.163@twwells.com> <255344AF.10561@ateng.com> <1989Nov6.064722.15635@twwells.com> <2558A19B.26552@ateng.com> <1989Nov13.09 Organization: None, Ft. Lauderdale, FL Lines: 131 In article <2561AFCE.2065@ateng.com> chip@ateng.com (Chip Salzenberg) writes: : According to bill@twwells.com (T. William Wells): : >According to chip@ateng.com (Chip Salzenberg): : >: o Do you want a mail to news gateway? : >: : >: In the system delivery file, notice addresses that look like newsgroups; : >: hand those messages to the gateway program. (I did this.) : > : >This I can do easily enough. Just have aliases for the newsgroups : >I want to gateway. : : Sure. That's easy enough. But what I meant by "notice" is to examine : the address and see if it looks like _a_ newsgroup: : : for u : do : case "$u" in : news-*) : group=`echo $u | sed -e 's/^news-//' -e 'y/-/./'` : cat $HEADER $BODY | mailnews-gateway $group : echo DROP ;; : *) : echo "$u" ;; : esac : done So, with this one, someone can mail to news-comp-mail-uucp and it goes to this newsgroup? Neat. I doubt I could do that sort of thing with lmail unless I were to add some kind of wildcarding or regular expressions. And I think that that goes way beyond what I'd want to do. And besides, there's already a solution. :-) : As you can see, one routine handles _all_ newsgroups. : : >Actually, I've had a slightly different interest: munging : >outgoing mail headers. An example: if I mail to a local mailing : >list, the To: line does not get a domain name. : : Mm. Not too hard. In the system or post-user delivery file: : : for u : do : case "$u" in : fake-mailing-list) : ( header -nvf To $HEADER : echo "To: real-mailing-list@mydomain" : echo "" : cat $BODY ) | smail -t : echo DROP : ;; : *) echo "$u" ;; : esac : done : : With this trick in place, you send mail to the fake-mailing-list. Deliver : then mangles your mail header and hands the mangled message over to Smail, : which then delivers to real-mailing-list. But that means that local users use a different address from everyone else! Before I'd do that, I'd set up the global mailrc to do the alias. (BTW, whether intentional or not, my mailer (mailx) substitutes aliases before putting the address on the To: line, so my current fix, since I'm the only one local posting to my list, is tolerable. But if any of my other users want to use a mailing list, I'm going to have to do something about this.) What I'd like to have is, if the To: address in locally generated mail does not contain an @ or !, to have my domain appended to it. While I don't know Deliver well enough to construct the script, I'm sure it can be done. But I think that this would best be done in smail rather than Deliver or lmail since smail sees all mail, whereas lmail or Deliver only sees it if it is a local address. The point being that if I mail to list,user@domain, fixing things in those would fix the mail sent to the list, but would not fix it in the mail sent to user@domain. : >Hey, I just had a thought: there is little reason for me not to : >add features that would permit easy integration of the two. I : >could look for .deliver files in user's home directories and, if : >found, run deliver for them instead of attempting normal delivery. : : I like this idea. Treat it as if the user's name were aliased: : : user: "user|/usr/bin/deliver user" That was the idea. (Oh yes, there is no : in the alias file; a name starting in column 1 indicates a new entry.) : In fact, I'd think the alias file reader might be the place to check for : whether .deliver exists. I'm not sure what you mean. In my code, I'd add the change to the alias expander: if a local address does not have forwarding set, I'd check for .deliver and, if it is present, alias the user name to the Deliver command. : >I have an alias bad-mail to which undeliverable mail is sent. : >I could easily add an alias, say try-mail, which is similar to this, : >except that, if mail to try-mail succeeds, no error code is returned. : : Hm. Neat. Of course, you must have some way to interpolate the (unknown) : address into an alias. I'll assume it's the character "@". The typical : lmail->deliver configuration might then be: : : try-mail: "root|/usr/bin/deliver @" : bad-mail: "root/Badmail" More likely, what I'd do is to append the list of failed names to the command, without any special interpolation character. The reason is this: if I add a general way to interpolate the address into the command, the address interpolated would be the aliased address. Which, in this case, would be try-mail! Whoops. So I need to have a mechanism for interpolating just those addresses which delivery failed for. Since that would be a special case kludge just for try-mail and bad-mail, there is no reason for being "nice". Which is why I'd just append the names to the command. I already have the list of invalid names, I use it for delivering bad-mail. When I deliver to bad-mail, I add an X-bad-address: to the mail headers so that I can see what went wrong. Of course, I wouldn't do that for try-mail. --- Bill { uunet | novavax | ankh | sunvice } !twwells!bill bill@twwells.com