sendmail internal forwarding to different domain
I wasn't sure where else to go for this issue, so I hope this question isn't too inappropriate for this forum.
I have an internal mail server (mailhost.domain.com) that receives all mail for several domains. It is behind a firewall and uses my ISP's smarthost for outbound mail. Nothing too special here and it is working just fine.
I have the situation where for *some* users I need to be able to keep a copy of their inbound mail while at the same time forwarding their mail to another host. As an example, on mailhost.domain.com in /etc/aliases, I have lines similar to this:
joe: /var/mai/joe, email@example.com
sue: /var/mai/sue, firstname.lastname@example.org
These entries allow the mail to be written locally as would normally happen and also be sent to specified accounts on another host. As long as the host is in domain.com, this doesn't seem to be a problem. Mail for email@example.com and firstname.lastname@example.org gets written to the file and forwarded as expected.
The issue is that I need to have an entry like this:
fred: /var/mail/fred, email@example.com
Where fred's address is firstname.lastname@example.org. It gets handled by the main mailhost as normal, but I need to send it elsewhere internally as well. A separate host in a separate domain.
123mail.example.com is fully resolvable from mailhost.domain.com -- meaning, nslookup sees the host and the appropriate MX records using our internal DNS. The problem is that sendmail doesn't seem to pay any attention to the local lookups and sends the mail out to the internet via the smarthost.
123mail.example.com is not reachable from the internet, nor is it resolvable from the internet. This causes all mail for this user to bounce with:
"host 123mail.example.com not found"
I think what I need is a way to tell sendmail not to use the smarthost for specific host delivery. But it must still handle outbound mail from email@example.com and pass it to the internet via the smarthost.
I know I can use mailertable to send the mail to the other domains, but that affects all users. What I need is a way for mail to hit the primary mailhost.domain.com, pass through /etc/mail/aliases for local file handling, and allow delivery to internal 123mail.example.com without using the smarthost.
In this particular case, 123mail.example.com is a ZCS host. Mail within ZCS domains is working fine. It's just getting the primary mailhost to send specific messages to the ZCS host that's causing me trouble.
I am at a complete loss as to how to do this and any help would be appreciated.
Thanks to all in advance,
[SOLVED] Re: sendmail internal forwarding to different domain
The trick, thanks to John B. at Sun, was to remove the use of smarthost from the sendmail configuration and move all routing to the mailertable function.
Basically, smarthost is an all-or-nothing switch and this is what was causing my problem. By switching to the mailertable, sendmail will process the domains locally. By adding the smarthost machine as the last entry in the mailertable as a wildcard entry, anything that doesn't match a locally managed domain will be sent out via the smarthost.
The dot (.) is the wildcard symbol in the mailertable.
Be sure to remove the SMARTHOST entry from the sendmail.mc file and the resulting sendmail.cf file and restart sendmail.
I hope others find this helpful. Again, all the credit goes to John B. at Sun.