Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

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
add comment

2 Answers 2

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 freebsd.mc file. Because the above link answers the question for Debian, here is what you need to do in FreeBSD:

# cd /etc/mail
# cp freebsd.mc box.example.com.mc
# vi box.example.mc (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 box.example.com in this list.

share|improve this answer
    
Only .mc files I have: freebsd.mc and freebsd.submit.mc, 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: freebsd.mc is what you need to copy from. I will update my answer. –  adamo Mar 4 '13 at 11:43
add comment

Find out which file holds your local host names with grep -i '^fw' sendmail.cf. Remove example.com 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
add comment

Your Answer

 
discard

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.