2
-bash-3.2# hostname 
name.foo.bar.domain.tld
-bash-3.2# 

whenever I send an email it leaves as [email protected], I need to have sendmail change it to [email protected]

how do I do that?

2 Answers 2

4

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.

4
  • after I make change to freebsd.mc what do I need to to in order to convert that .mc to .cf?
    – alexus
    Sep 22, 2009 at 14:14
  • make -C /etc/mail ?
    – alexus
    Sep 22, 2009 at 14:26
  • updated the answers with make usage
    – Craig
    Sep 22, 2009 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, 2009 at 15:01
1
# 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

5
  • 1
    so I should have Dj$w.domain.tld ?
    – alexus
    Sep 16, 2009 at 21:53
  • yes, something like that
    – quaie
    Sep 17, 2009 at 8:22
  • i tried in both sendmail.cf and submit.cf, not working for me...
    – alexus
    Sep 18, 2009 at 14:21
  • did you restart sendmail after modifying .cf ?
    – quaie
    Sep 18, 2009 at 20:55
  • of course /etc/rc.d/sendmail restart
    – alexus
    Sep 21, 2009 at 14:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .