I'm trying to configure sendmail on Centos 5 so that all mail goes through another SMTP server. In this case, it happens to be an Exchange Server. I've edited the sendmail.mc file with this line:

define(`SMART_HOST', `')dnl

But when I try to send an e-mail, I get the following error:

Nov  2 14:02:00 COMPUTERNAME sendmail[1370]: oA2K1xht001368: to=<testemail@test.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=120355, relay=, dsn=5.1.2, stat=Host unknown (Name server: host not found)

The box is accessible from the box I am sending mail from. Meaning, I can ping and get good responses. So I don't understand why sendmail can't find the host. Any ideas? Thanks.

  • Are you able to telnet to port 25 on the target server from the sendmail host? Nov 2 '10 at 20:27
  • Yes, "telnet 25" works for me and connects fine. I can get a Hello....Oh, just noticed that the Hello I get back says the IP is Is that normal?
    – user43049
    Nov 2 '10 at 20:31
  • Use msmtp instead. May 13 at 9:34

Sendmail appears to be doing a name lookup on ''. Change the sendmail.mc to point to a hostname. If the hostname isn't in DNS you can put it into /etc/hosts.

  • Tried to get in touch with the IT guy to figure out the hostname for that box. But in the meantime I tried embobo's fix and it worked. Thanks for the answer.
    – user43049
    Nov 2 '10 at 20:37

Otherwise you can put the IP address in square brackets: [].

  • That was it. Strange that it doesn't recognize an IP address automatically. Thanks.
    – user43049
    Nov 2 '10 at 20:36
  • OK, since both answers worked, but jcollie's answer was first and it saves me from having to change the IP address if the Exchange Server gets moved, I'm going to give him the answer. Thanks so much for your help.
    – user43049
    Nov 2 '10 at 20:43

Did you generate a new sendmail.cf file after modifying sendmail.mc?

# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Also, don't forget to restart the service.

# service sendmail restart

  • Thanks for the answer. Looks like I just needed to find out the hostname, because sendmail was attempting to do a name lookup on the IP address.
    – user43049
    Nov 2 '10 at 20:44
  • Ahhh, I see that now. I swear the question wasn't solved when I first started looking for the notes I had on this. :) Nov 2 '10 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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