- Posted In
- Red Hat Enterprise Linux
sendmail not using mailertable...
I'm having trouble getting my mailertable to work....
/etc/mail/sendmail.mc contains this line FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl /etc/mail/mailertable contains this line domain1.com esmtp:[10.210.5.22]
I ran these to "recompile" the settings...
makemap hash /etc/mail/mailertable.db < /etc/mail/mailertable m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf service sendmail restart
Then tried to send a test
$ mail -s "test email" email@example.com
$ tail -f /var/log/maillog May 9 10:03:14 npsetl005 sendmail: p49E3EG0027777: to=<firstname.lastname@example.org>, ctladdr=<email@example.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120350, relay=www.domain1.com. [172.16.1.47], dsn=4.0.0, stat=Deferred: Connection refused by www.domain1.com.
We have this stupid problem on our internal network where DNS and MX records aren't really set up 100 percent correctly. Getting permission to change it, and test it are way beyond the scope of this question; So I just want sendmail to ignore what's in DNS and fire messages straight to our internal relay server (which works for dozens of other clients) - but it's not doing that. You can see that it's rewriting the addresses to firstname.lastname@example.org because the parent *.domain1.com is a cname to www.domain1.com (someone did this as a poor mans redirect. So if a user tries to go to a subdomain that doesn't exist, they go to the root website instead... I know. I know.)
Contents of mailertable.db
It's been ages since I've bothered with Sendmail. That said, I seem to remember that, for a number of the keyed tables, if you wanted to map domains (i.e., your "domain1.com") as well as subdomains (i.e., your "www.domain1.com") you'd need your mailertable to look like:
I may be remembering for another table-type, though.
We only have 1 domain. (domain1.com in this case) the www.domain1.com is invalid. There aren't any subdomains being mapped here... I'll add it to the file and see what happens, or just go scream and yell at the DNS people and fix it properly.
Same thing when I added *.domain1.com - it's still going to DNS and looking up mx records...
Mail addressed to email@example.com gets this in the log file...
Just checked the definitive guide (http://www.sendmail.org/m4/mailertables.html). Instead of "*.domain1.com" to catch the www.domain1.com value, it would be just ".domain1.com". It might be interpreting the "*" literally.
You want to leave the asterisk off to glob everything underneath.
This behavior is controlled by two features in Sendmail FEATURE(`relay_hosts_only') or FEATURE(`relay_subdomains').
You can test your mailertable directives with "sendmail -bt", specifying a ruleset of "/map mailertable" and a destination domain.