trouble delivering mail to local LAN hosts

I have a Linux mail server. It receives all email for the enterprise. the Linux server (webserver) delivers mail for local users and passed all other mail to a smart host, Exchange 2007 server.

I want to send mail from this host to a peer Linux host on the LAN. The LAN domain is hprs.local.

If I send mail from webserver to Linux host  root@ohprstorage.hprs.local, it routes through the Exchange server, which rejects it. That makes sense as it is not a local user either on the Linux webserver host or in the Exchange domain.

After adding ohprsstorage.hprs.local to the /etc/mail/local-host-names the message gets delivered to root@webserver, not to root@ohprsstorage. That kind of makes send too since perhaps putting ohprsstorage.hprs.local in /etc/mail/local-host-names means "deliver to local user".

So, I can send this email to the Exchange Server smart host, I can send it to a local user; how do I send a message to a user on another host on the hprs.local LAN?
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.

Local delivery requires two things:
The host accepting the emails must be configured correctly (accepting users you added, to the hostname you configured, could be anything from to 123@xxx.local)
You can use telnet command to test if it's working for delivery using
telnet desiredhost 25
mail from:webserver@xxx.xx
rcpt to:
subject: test


After this gives you the OK received response, proceed to check if you can get the email by using your favorite email client.

The sending machine must know where the email is going to (your desired host), so you have to adjust the DNS server it is using (hopefully under your control also, if not, point it to a DNS you control inside the network), proceed to add an mx record for or xxx.local to point to the host you want to accept the email.
MarkAuthor Commented:
OK, one step at a time. The telnet example you gave me works fine. The message was received on the other end.

$ telnet ohprsstorage 25
Connected to ohprsstorage.
Escape character is '^]'.
220 OHPRSstorage.hprs.local ESMTP Sendmail 8.14.4/8.14.4; Fri, 20 Sep 2013 20:20:46 -0400
helo ohprsstorage
250 OHPRSstorage.hprs.local Hello [], pleased to meet you
mail from:mfoley@webserver
250 2.1.0 mfoley@webserver... Sender ok
rcpt to:root
250 2.1.5 root... Recipient ok
354 Enter mail, end with "." on a line by itself
subject: test

Open in new window

> The sending machine must know where the email is going to (your desired host), so you have to adjust the DNS server it is using

Well, that's the problem. the sending machine *can* see the target machine:

$ ping ohprsstorage
PING OHPRSstorage ( 56(84) bytes of data.
64 bytes from OHPRSstorage ( icmp_req=1 ttl=64 time=0.068 ms
64 bytes from OHPRSstorage ( icmp_req=2 ttl=64 time=0.073 ms
64 bytes from OHPRSstorage ( icmp_req=3 ttl=64 time=0.052 ms

$ nslookup ohprsstorage

Name:   ohprsstorage.hprs.local

Open in new window

I think my problem is that sendmail is set up to forward non-local recipient email to a smart host. That smart host has no knowledge of this ohprsstorage host. So, I think what I need is some way to configure the local sendmail on webserver to send all non-local mail to the smart host EXCEPT for mail destined for the ohprsstorage host. I'd like webserver to deliver to that host itself.

I thought there would be extra server involved not mentioned before for the other emails (as you end the original post with "on another host on the LAN"). But now I think you want to keep it at the server. Which means you have to configure sendmail in unison with procmail (for local delivery). Therefore your title "trouble delivering mail to local LAN hosts" is a bit misleading. I suggest you start a new topic in one of the linux/unix/mail related categories with a title something like "sendmail/procmail configure both local delivery and relay to smarthost". Explain you want your current sendmail server to accept mail for xxx@ohprsstorage.hprs.local and relay the rest to your current smarthost.
I can't help you any further, I thought it was a simple design structure problem. I never dug deep enough in sendmail/procmail.
MarkAuthor Commented:
No worries, I've figured it out! All I had to do was add the following line to /etc/mail/mailertable (and make mailertable.db, of course):

ohprsstorage.hprs.local         smtp:ohprsstorage.hprs.local

So, the mail server, WEBSERVER, will first send any mail for the host specific on the Left Hand to the host specified on the Right Hand using the specified mailer (smtp). After taking care of mailertable entries, it will then, per usual, deliver mail for local users locally and then send all other mail to the smart host, this time excluding mail for ohprsstorage.hprs.local.

If I add more hosts to the hprs.local domain (which I probably will) I can use additional mailertable entries to router mail to the various hosts.

Simple, but a lot of research to figure out.

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
MarkAuthor Commented:
Thanks for participating!
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
Email Servers

From novice to tech pro — start learning today.