We have an internal network, which has its own DNS servers for that network. Internet addresses are not resolved on that network, except for some servers which have internet access.

One of such servers with internet access is acting as a relay host for others so they can send e-mails (reports, logwatch,...) to admins. This relay server has also one relay server defined on the internet, but that is not relevant. It works fine that way except for one strange exception.

I have Oracle Linux 8 on one of the servers that uses relay host. Usually I have to add

define(`SMART_HOST', `relay_hostname')dnl

to sendmail.mc, but on this one it does not work. I can't get it to use the relay. It always relays to root@localhost. At least that is what it writes to /var/log/maillog. I tried [relay_hostname], relay:[relay_hostname] for SMART_HOST, and many other configuration settings.

When I test with

mail -s test [email protected]

The maillog reports something like this:

Aug 31 09:44:14 hostname sendmail[694964]: 17V9iE4L694964: [email protected], size=15, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Aug 31 09:44:14 hostname sendmail[694964]: 17V9iE4L694964: [email protected], delay=00:00:00, mailer=relay, pri=30015, dsn=4.4.3, stat=queued

The message does not end up in queue in that case.

I tried also sending the mail with

(echo subject: test; echo) | /usr/lib/sendmail -Am -v [email protected] [email protected]

With that command I get the answer

internet-domain.com: Name server timeout
[email protected]... Transient parse error -- message queued for future delivery
[email protected]... queued

Log, in this case, is practically the same

Aug 31 11:42:43 hostname sendmail[698071]: 17VBghos698071: [email protected], size=15, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Aug 31 11:42:43 hostname sendmail[698071]: 17VBghos698071: [email protected], delay=00:00:00, mailer=relay, pri=30015, dsn=4.4.3, stat=queued

The message enters the queue with sendmail command, but stays there forever.

It is correct that internet-domain.com cannot be resolved. I guess the problem is that internet-domain.com cannot be resolved, and sendmail does not use SMART_HOST in that case. How can I force sendmail to use the SMART_HOST always also with unresolved domains for addressee? It should be the job of relays to reject messages with wrong destination addresses.

I have identicaly configured sendmail on CentOS 8, which sends e-mails via relay just fine. The difference is that CentOS 8 can resolve internet domains.

An update. If I send a mail to an internet domain, the sendmail uses localhost as a relay, and mail goes nowhere, as described above.

If I send it to a domain, that can be resolved internaly by internal DNS, it is sent to a relay server defined as SMART_HOST. Relay server relays it. However, that is not a valid internet domain and an e-mail account does not exists. Therefore, the mail with wrong address cannot be delivered, and I get a report about that with the undeliverable mail as an attachment.

Another update. If I add


to /etc/mail/sendmail.mc, some mails get through. If I send to a valid internet mail, it still doesn't get through. However, I have an alias for root in /etc/aliases which points to the same address I am testing with mail commands. If I send a mail to root, it gets through, because aliases redirect it. In that case, internet e-mail does not confuse sendmail and the smart host is used for relaying. It is enough for me, as I only need admin mails for root from this server, but the problem is still not fully solved.


# Person who should get root's mail
root:       [email protected]
  • You've processed sendmail.mc to generate sendmail.cf? Does your actual relay_host (as defined in your sendmail.mc) appear in the cf? Aug 31, 2021 at 11:38
  • 1
    @roaima Yes. For every change in /etc/mail I remake configuration files (including sendmail.cf), and restart sendmail. The changes are reflected in *.cf and *.db files.
    – nobody
    Aug 31, 2021 at 11:41
  • relay_hostname resolves correctly? Aug 31, 2021 at 12:17
  • 1
    Yes relaying_hostname resolves (hostname and IP), and I was also trying with to enter IP for SMART_HOST. Khm... Oops. Well I found a typing error in hostname for a sending server, but after correction still doesn't work.
    – nobody
    Aug 31, 2021 at 12:25
  • 1
    relay_hostname is a placebolder for a fqdn name. It is resolved ba DNS bothways. Ip is resolved from name and name is resolved from fqdn.
    – nobody
    Aug 31, 2021 at 14:58

1 Answer 1


I have found a solution, and now I remember I used that solution a while ago on CentOS 5. However, it did not seem to me as important, as I was sure that things have changed a lot since the last time I used it. I am pretty sure that it was showing different behaviour back then, but the solution is the same.

The solution is to add (uncomment) the following line in /etc/mail/submit.mc.


And I think the following line described in the question as one of the attempts should be in /etc/mail/sendmail.mc, too.


You must log in to answer this question.

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