Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I send mail using PHP. Everything works good until I send mail to domain ( which I have in /etc/rc.conf >> hostname="".

I guess sendmail catches mail for this domain (even when I use its subdomain in rc.conf) before sending it to world. So, how can I make sendmail to ignore local domain(s) other than localhost?

share|improve this question
I guess it will be better to avoid using same hostname for server itself and domains I use for www/mail in future. – Martin Mar 4 '13 at 9:27

This is a recurring question, but it is the first time I've seen it for FreeBSD. See this answer on how to edit your file. Because the above link answers the question for Debian, here is what you need to do in FreeBSD:

# cd /etc/mail
# cp
# vi (and follow the instructions of the link above)
# make all install restart

You can now test the solution.

Since you write that /etc/mail/local-host-names does not exist, run sendmail in test mode with sendmail -bt and then at the > prompt type $=w. This will list you all the names that sendmail considers local. You will see in this list.

share|improve this answer
Only .mc files I have: and, is it one of them? – Martin Mar 4 '13 at 9:16
I changed server hostname in /etc/rc.conf - to avoid this behaviour. It is cheaper to do/remember than reconfiguring mail server. – Martin Mar 4 '13 at 9:40
My (memory) mistake: is what you need to copy from. I will update my answer. – adamo Mar 4 '13 at 11:43

Find out which file holds your local host names with grep -i '^fw' Remove from the file so named.

share|improve this answer
file /etc/mail/local-host-names does not exist – Martin Mar 4 '13 at 8:27
That's interesting; I'm slightly surprised sendmail starts up at all. In that case, I defer to adamo's suggestions above (which I will now upvote). Though you could try creating a blank local-host-names and see if that cures sendmail of making assumptions. – MadHatter Mar 4 '13 at 9:20
This is how it is in default FreeBSD 9.1 installation. Creating blank local-host-names made no change. – Martin Mar 4 '13 at 9:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.