Re: [Exim] Matching GECOS field for mail delivery

Top Page
Delete this message
Reply to this message
Author: Vadim Vygonets
Date:  
To: exim-users
Subject: Re: [Exim] Matching GECOS field for mail delivery
Quoth Jonathan Hunter on Sun, Oct 31, 1999:
> I'm setting up a mail server for a company, and they want to have email
> addresses in the form firstname.lastname@???. The actual UNIX
> usernames on the server will be based on peoples' initials, but the GECOS
> field in /etc/passwd will contain their full name.


The obvious solution is to use an alias file (probably, a
dedicated alias file). BTW, when you write the script to
generate those addresses, be careful not to have to John Smiths
in your company.

> My first question is, has anybody implemented this using Exim before?


Yes, some people have.

> I know it can be done using alias files, but that's not as elegant as
> doing a "live" lookup on /etc/passwd.


It would be a little hard to do it using /etc/passwd. And a dbm
aliasfile is a lot faster, _even_ if you use BSD (which builds
its passwd file as dbm), because you need to read every record
and check the full name. You can't lookup entry in passwd using
full name as the key.

> When a new user is added, their mail
> should work straight away without editing alias files.


Automation is your friend. Your adduser script probably already
does more than one thing, so just modify it to do yet another
thing.

> And yes, I do know
> the problems that can arise if two people of the same name join the
> company - this company only has a small number of employees and that is not
> a worry at the moment.


I actually always wondered what e-mail addresses two guys with
the same name get. john.smith and john.smith.2?

> Where would be the best place to add this to Exim's configuration?


An aliasfile director after system_aliases seems to be fine. If
you also want to preserve suffixes, mail me and I'll give you a
recipe. In this case, though, it would be smartuser and not
aliasfile. The thing I don't know is which is more efficient.
Smartuser, probably.

> Would using rewriting be a better method?


I would not use rewriting for this.

Vadik.

-- 
If you think C++ is not overly complicated, just what is a protected
abstract virtual base pure virtual private destructor, and when
was the last time you needed one?
        -- Tom Cargill, C++ Journal, Fall 1990.