Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I've got sendmail running on a linux box. Let's say the hostname of the box is If I run the following command, I don't receive the email (which is hosted with a third party), presumably due to the hostname pointing to the local machine.

echo "Test Body" | mail -s "Test Subject"

Is there any way to get this to work so that I can receive emails at my third party email address even though it has the same hostname? Do I have to change the hostname of this server (not preferred)?

It may be worth noting that I created a user "foo" on my machine and noticed that the mailbox for that account is empty.

I noticed these log entries, which may or may not be relevant:

Jun 28 01:09:48 bar sendmail[14338]: p5S59min014338: from=apache, size=80, class=0, nrcpts=1, msgid=<>, relay=apache@localhost
Jun 28 01:09:48 bar sendmail[14339]: p5S59mIA014339: from=<>, size=293, class=0, nrcpts=1, msgid=<>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.$
Jun 28 01:09:48 bar sendmail[14338]: p5S59min014338:, ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30080, relay=[] [], dsn=2.0.0, stat=Sent (p5S59mIA$
Jun 28 01:09:48 bar sendmail[14340]: p5S59mIA014339: to=<>, ctladdr=<> (48/48), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30495, dsn=2.0.0, stat=Sent
share|improve this question
First off, should not be your hostname--that's a domain name. Your host name should be Having domain names and hostnames confused like that can lead to all sorts of icky problems--especially in a program as hard to configure as sendmail. – Flimzy Jun 28 '11 at 5:25
Just so I know where you're coming from, you have two hosts. One believes it is the host with name (/etc/hosts?), while the other is configured as the mail exchanger (MX record) for (this one in DNS/global DNS/public DNS?). You would like to receive email destined for at the second host. Is that accurate? – Slartibartfast Jun 28 '11 at 5:34
@Slartibartfast that is correct. @Flimzy, there's definitely some truth to that and I should look into that. – dtbarne Jun 28 '11 at 5:36

With Flimzy's comment, I was able to get this working. It may not be the exact solution to my original question, but it is true that the server's hostname should be a subdomain.

What I did was changed the hostname to

(Fedora specific instructions)

For the existing session: hostname

Permanently: edit /etc/sysconfig/network

Then service sendmail restart and voila!

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.