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.
-bash-3.2# hostname 
name.foo.bar.domain.tld
-bash-3.2# 

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

how do I do that?

share|improve this question

2 Answers 2

up vote 2 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:

define(`confDOMAIN_NAME',`domain.tld')

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

Djdomain.tld

(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 freebsd.mc and freebsd.submit.mc to ${HOSTNAME}.mc and ${HOSTNAME}.submit.mc then generate the .cf files
make install   # will copy ${HOSTNAME}.cf and ${HOSTNAME}.submit.cf to sendmail.cf and sendmail.submit.cf
make restart  # will restart your sendmail processes

you must be root.

share|improve this answer
    
after I make change to freebsd.mc 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}submit.mc not ${HOSTNAME}.mc –  alexus Sep 24 '09 at 15:01
# my official domain name
# ... define this only if sendmail cannot automatically determine your domain
#Dj$w.Foo.COM

should be in /etc/mail/sendmail.cf

share|improve this answer
1  
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 sendmail.cf and submit.cf, 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

 
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.