After changing my sendmail setup, I've got most things working, but sendmail incorrectly sends email to "foo@localhost" to port 25, instead of delivering it locally. How to fix?:
Everything worked fine before the change, but I suspect sendmail.cf was doing the work that submit.cf does no.
When I email "foo@localhost", I want /usr/lib/sendmail to look in /etc/mail/aliases (or aliases.db), and do a local delivery to foo's target, which could be a local user, a pipe, a mailing list, etc.
I do NOT want /usr/lib/sendmail to pass foo@localhost emails to port 25. My port 25 is an stunnel: once an email reaches port 25, there's no hope of local delivery.
My /etc/hosts has "127.0.0.1 localhost.localdomain localhost", so I think sendmail parses "localhost" as "localhost.localdomain", but not sure.
Here are the localhost-related entries in sendmail.cf (tabs compressed to single space for viewing purposes)
[if someone could cut/paste the content of this + the other URLs into this message, I'd be most appreciative; my attempts failed miserably]
- And the localhost-related entries in submit.cf (also tab-compressed)
- The diff between the two (diff submit.cf-chunk sendmail.cf-chunk):
Yes, I realize the duplicate "Cw" entry in both files is pointless, but it's never hurt sendmail.cf, so I'm not worried about it yet.
I'm tempted to tweak submit.cf's quoted lines to match sendmail.cf's quoted lines, but I'd really like to understand what's going on before doing anything more. The hit-and-miss approach to *.cf editing is starting to worry me.