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

Im running logwatch on red hat 7 it sends mails using root@localhost.localdomain however, the email from localhost.localdomain is not received at the recipient because localhost.localdomain is not registered. I want to change logwatch or mail to send from for example instead of root@localhost.localdomain. Can anyone help me? I have already tried changing logwatch.conf with MailFrom = but did not work. Logwatch is using mail (not sendmail) .

share|improve this question

In your /etc/mail/ add the following lines at the end:


Where Real.Host.Name is the real host name of the machine. $j is the macro that holds the hostname. After that rebuild and restart sendmail. In Debian you do this by running sendmailconfig. In CentOS you first run /etc/mail/mail and then service sendmail restart.

share|improve this answer
The cleaner way is to define confDOMAIN_NAME as described in file cf/README section "who Am I". – Andrzej A. Filip May 9 '13 at 19:11
Oh some times you can't teach an old dog new tricks :) – adamo May 10 '13 at 8:28
@AndrzejA.Filip Please submit this as a separate answer for better visibility and sweet, sweet, delicious upvotes! – Aaron Copley Sep 29 '14 at 23:48
@AaronCopley done – Andrzej A. Filip Sep 30 '14 at 13:56

cf/README - Who Am I?

You may define confDOMAIN_NAME in

define(`confDOMAIN_NAME', `Real.Host.Name')dnl 

P.S. After changing generate new

share|improve this answer

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.