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
-bash-3.2# hostname

whenever I send an email it leaves as, I need to have sendmail change it to userid@domain.tld

how do I do that?

share|improve this question
up vote 3 down vote accepted

Assuming you are using the default installed FreeBSD sendmail you should not be editing the .cf files directly. They are generated from .mc files in the /etc/mail directory.

There is a Makefile in /etc/mail that will generate the .cf from the .mc files

Add the following line to the .mc files to set the default domain:


If you really want to edit the .cf file directly, I believe the correct line is:


(don't include the $w.)

Update: How to use make to regenerate your .cf

cd /etc/mail
make #the first time you do this it will copy and to ${HOSTNAME}.mc and ${HOSTNAME} then generate the .cf files
make install   # will copy ${HOSTNAME}.cf and ${HOSTNAME} to and
make restart  # will restart your sendmail processes

you must be root.

share|improve this answer
after I make change to what do I need to to in order to convert that .mc to .cf? – alexus Sep 22 '09 at 14:14
make -C /etc/mail ? – alexus Sep 22 '09 at 14:26
updated the answers with make usage – Craig Sep 22 '09 at 22:35
that worked, thank you very much although just FYI for others you need to make a change to ${HOSTNAME} not ${HOSTNAME}.mc – alexus Sep 24 '09 at 15:01
# my official domain name
# ... define this only if sendmail cannot automatically determine your domain

should be in /etc/mail/

share|improve this answer
so I should have Dj$w.domain.tld ? – alexus Sep 16 '09 at 21:53
yes, something like that – petre Sep 17 '09 at 8:22
i tried in both and, not working for me... – alexus Sep 18 '09 at 14:21
did you restart sendmail after modifying .cf ? – petre Sep 18 '09 at 20:55
of course /etc/rc.d/sendmail restart – alexus Sep 21 '09 at 14:55

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.