Sendmail configuration

I'm running sendmail 8.8.6 on a Slackware Linux box which is serving as a mail server (i.e. several DNS MX records) for multiple domains.  All has been fine in the setup for some time.

I've now run into a situation that needs some help.  Currently, the usernames are common between the different domains served.  For example, is equivalent to and so on. They both end up in the mail inbox for john on the server.

The need now is to be able to map each of the above to DIFFERENT mail boxes on the server.  So: --> Maps to john_a --> Maps to john_b

of similar.

(BTW, please don't supply answers using the M4 configuration for  It's too cryptic and we don't use it.)
LVL 32
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

how about using /etc/aliases
Do I understand right that the MX record for both domains point to the same server (sendmail)?
jhanceAuthor Commented:

I guess I don't see how /etc/aliases can help here.  Since the domain name is already stripped off by the time the address gets to /etc/aliases, there is no useful effect there.

You are correct that there are MX records for multiple domain names that point to the same mail server.
I'm not shure about sendmail 8.8.6, but sendmail 8.9.x can use mailertables for this purpose.
The trick is FEATURE(mailertable), see the docs for details, sounds simple (didn't test it).
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

just add the line


to /etc/alias
jhanceAuthor Commented:

Please read my question more closely.

Your suggestion just does what I currently have a different way.  I want these two addresses to be directed to separate email addresses.

The aliases line:


will cause incoming mail for john to be directed at both john_a and john_b.  This is not what I want.
jhanceAuthor Commented:
Adjusted points to 150
you also may use procmail to what you want, it can setup filters to deliver mail into different mailboxfiles
procmail is under the user's (john) control, and does not need any changes in sendmail (or any other MTA)
You will have to use the virtusertable-feature. Read about it at

I know you said you don't use the m4 configuration tools, but there is really no way around it in this case. And it's only about 25 lines of code?? I have a similar server with 15 doamins getting mail by ETRN and 15 domains getting it by POP, and several of the users have the same usernames.

It's hard setting it up the first time, but then it just works.

You're welcome to mail me at, if you want to test it further or get more help.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jhanceAuthor Commented:
Too bad you got the points for this wrong answer.  I must have missed your posting this answer and the autograder got to this question.

Virtual Hosting is _NOT_ the solution to this problem, it's the solution to the inverse of this problem.  I already have the mail server operating as a virtual host but what I want is the ability to have sendmail differentiate between identical user names sent to different hosts that the mail server.

Virtual hosting does this: --->  user1 --->  user2

What I want it: ---> user1 ---> user2

See the difference?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.