0

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?

Martin
  • 109
  • 2
  • 5
  • 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 04 '13 at 09:27

2 Answers2

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.

adamo
  • 6,867
  • 3
  • 29
  • 58
  • Only **.mc** files I have: **freebsd.mc** and **freebsd.submit.mc**, is it one of them? – Martin Mar 04 '13 at 09: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 04 '13 at 09:40
  • My (memory) mistake: freebsd.mc is what you need to copy from. I will update my answer. – adamo Mar 04 '13 at 11:43
0

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

MadHatter
  • 78,442
  • 20
  • 178
  • 229
  • file /etc/mail/local-host-names does not exist – Martin Mar 04 '13 at 08: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 04 '13 at 09:20
  • This is how it is in default FreeBSD 9.1 installation. Creating blank `local-host-names` made no change. – Martin Mar 04 '13 at 09:25