[comp.mail.sendmail] Simple Ruleset Sought

tpf@pyr.gatech.EDU (Tom Friedel) (05/08/89)

I'm not sure how my sendmail/smail/uux setup is incorrect, but
if I had a ruleset that would convert 

   A!B!C@D  to  A!B!D!C

I think things would work better.

I am running SysV 386/ix with sendmail.  If this question provides
insight into the real problem, let me know.

Thnaks much for anyones time,


JDyx Public Access Unix Board   |  Tom Friedel 
...gatech!emory!jdyx!tpf        |  tpf@pyr.gatech.edu
(404) 321-5020                  |  (404) 320-7624 

steve@polyslo.CalPoly.EDU (Steve DeJarnett) (05/09/89)

In article <8130@pyr.gatech.EDU> tpf@pyr.gatech.EDU (Tom Friedel) writes:
>I'm not sure how my sendmail/smail/uux setup is incorrect, but
>if I had a ruleset that would convert 
>
>   A!B!C@D  to  A!B!D!C
>
>I think things would work better.

	Treading into dangerous waters here, but I'll give this a shot.
I think the translation you suggest here is wrong, according to RFC 822.  I
think the way this should be translated is:

	A!B!C@D  yields	   D!A!B!C

You should (God, I hope this is right) always take the rightmost domain first,
and use the preceeding UUCP bang-path address as fodder for D's mailer (it is
presumed that D has a route to A, or can figure one out).

	If I'm wrong, I'm sure someone will correct me, but I think in this 
case I have that right.  If that's not what you're asking, then I must have
misunderstood the question.

-------------------------------------------------------------------------------
| Steve DeJarnett            | Smart Mailers -> steve@polyslo.CalPoly.EDU     |
| Computer Systems Lab       | Dumb Mailers  -> ..!ucbvax!voder!polyslo!steve |
| Cal Poly State Univ.       |------------------------------------------------|
| San Luis Obispo, CA  93407 | BITNET = Because Idiots Type NETwork           |
-------------------------------------------------------------------------------

matt@oddjob.uchicago.edu (Matt Crawford) (05/09/89)

>if I had a ruleset that would convert A!B!C@D to A!B!D!C
>I think things would work better.

Without judging whether this is the right thing to do, here is a
sequence of rules to make that transformation.  I assume there may be
more than two !s in the input, and also that there are no bracketing
angle brackets present when these rules are invoked.  Oh, and I also
assume that any of A, B, ... may consist of multiple "words".

R$+!$+@$+		$:$1!<$2@$3>		focus on at-sign
R$+<$+!$+@$+>		$1$2!<$3@$4>		get all bangs outside
R$+<$+@$+>		$1$3!$2			convert at-sign to bang

Exercises for those still learning the cf language:
1. Why is the second rule needed?
2. Why is the "$:" needed in the first rule?  Why not in the third?


In case, as Steve DeJarnett suggested, you really want to turn A!B!C@D
into D!A!B!C (although RFC822 has little or nothing to do with this), a
single rule suffices.

R$+!$+@$+		$3!$1!$2		final at-sign to initial bang


Any of these rules could have undesired effects when the input is not of
the assumed form ... for instance, if there are multiple @s.
________________________________________________________
Matt Crawford	     		matt@oddjob.uchicago.edu