I've got sendmail running on a linux box. Let's say the hostname of the box is bar.com. 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" foo@bar.com

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=<201106280509.p5S59min014338@bar.com>, relay=apache@localhost
Jun 28 01:09:48 bar sendmail[14339]: p5S59mIA014339: from=<apache@bar.com>, size=293, class=0, nrcpts=1, msgid=<201106280509.p5S59min014338@bar.com>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.$
Jun 28 01:09:48 bar sendmail[14338]: p5S59min014338: to=foo@bar.com, ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30080, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p5S59mIA$
Jun 28 01:09:48 bar sendmail[14340]: p5S59mIA014339: to=<foo@bar.com>, ctladdr=<apache@bar.com> (48/48), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30495, dsn=2.0.0, stat=Sent
link|improve this question
1  
First off, bar.com should not be your hostname--that's a domain name. Your host name should be something.bar.com. 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 bar.com (/etc/hosts?), while the other is configured as the mail exchanger (MX record) for bar.com (this one in DNS/global DNS/public DNS?). You would like to receive email destined for foo@bar.com 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
feedback

1 Answer

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 abc.bar.com:

(Fedora specific instructions)

For the existing session: hostname abc.bar.com

Permanently: edit /etc/sysconfig/network

Then service sendmail restart and voila!

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.