Massaging email addresses to find a common domain

I need to find a “simple” and “logical” way to find if mail being sent is going to someone inside my domain or external - other than by looking up on Domino Directory (user may be offline without full local directory).

For example, say my email is wn@uc.ibm.com.uk I’m sending to

fred@uc.ibm.com.au

joe@ibm.com

mary@ger.ibm.co.de

john@ibm.org.

The first three are inside my domain, but john isn’t.

Anyway I can code this? NotesName doesn’t do it.

Subject: How did you work out

that wn@uc.ibm.com.uk is in the same Domain as fred@uc.ibm.com.au

joe@ibm.com

mary@ger.ibm.co.de

and not

john@ibm.org.

If you can explain how you worked it out, maybe it could be coded. If you worked out because you just knew, then its probably hard to code.

Subject: logical distinctions

Here’s how I’m looking at it…

In the first place, different top level Domains cannot be a common domain. Therefore, .org can’t be the same as .com (or its derivative .co). So john@ibm.org can’t be in the same domain as fred@ibm.com. I think I can get away with distinguishing between 4 TLDs (.co?, .net, .org, .gov).

Next, same organization in different countries could have .?? as two-digit country identifier. So for my purposes @ibm.com = @ibm.co.de = @ibm.com.au

Finally, some organizations put on a prefix before domain to indicate some structure. So for my purposes @work.ibm.com = @home.ibm.com.

And all combinations…

Am I making sense? Thank you very much for any guidance.