On Wed, 20 Aug 1997, John Attwood wrote:
> I have a single rewriting rule, which recognises addresses of
> the form user@host or user@??? and rewrites them
> as user@??? with flags bcfrtE. The idea of this was
> to suppress the hostname, or fully-qualified domainname, which
> is inserted by some mailtools and/or some users. The rule is
> presently:-
>
> ^(.*)@[^.]+(.gene.ucl.ac.uk)*$ $1@LOCAL_DOMAIN bcfrtE
You are missing \ characters in ".gene.ucl.ac.uk" and it might be better
to have "?" rather than "*" at the end.
> However, we keep getting undeliverable mail now, and this takes
> the form of an unrecognised user in our local mail domain. I am
> assuming that this is the result of incoming mail with
> user@remotehost in the From:, Reply to: or Cc: headers, which
> are being rewritten by my rule to appear to be users here.
Yes, such illegal addresses would get written that way by that rule.
That is,
From: user@abcd
would get turned into
From: user@LOCAL_DOMAIN
> Any suggestions as to how to cope with this? I definitely need
> a rewriting rule along these lines, as both users and mailtools
> will attempt to put user@host in some of the headers, but I only
> want the rule to be applied to locally-generated or relayed
> mail, not in incoming mail from outside.
Not always easy to distinguish, what with mail forwarding and the like.
Exim automatically sorts out To: headers that contain the same addresses
as the envelope if an envelope address gets qualified when it is looked
up in the DNS. However, this doesn't happen to From: lines.
Users and mailtools shouldn't do that, of course. They should always use
fully qualified addresses, especially in the From: and similar fields.
> Here are the headers from a message I received recently, to which
> I was unable to reply (names changed to protect the innocent). You
> can see that our mail domain (galton.ucl.ac.uk) appears in both the
> From: and Cc: headers, despite the fact that the message originated
> in the USA:-
> >From jsmith@??? Wed Aug 20 10:41:28 1997
> From: jsmith@??? (John Smith)
I bet that originally read
From: jsmith@catsun
which is of course invalid. I don't know what you can do about this,
other than educate your users and your software. Even if Exim could
apply rewriting rules "only to messages not from outside", it might be
very hard to define what you mean by "outside". The only thing I can
think of would be to enumerate the local single-component names that you
recognize and rewrite only those, which could be very tedious, though
you could put them in a file and do a lookup for them.
--
Philip Hazel University Computing Service,
ph10@??? New Museums Site, Cambridge CB2 3QG,
P.Hazel@??? England. Phone: +44 1223 334714