If you have configured Sendmail on your Linux system and are still unable to send emails because of a unqualified hostname
error, we have a few suggestions that you can use to try and remedy the issue.
In this tutorial you will learn:
- How to solve
unqualified hostname
error in Sendmail
Category | Requirements, Conventions or Software Version Used |
---|---|
System | Any Linux system |
Software | Sendmail |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions | # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
Sendmail unqualified hostname error
The Sendmail error will look something like this:
debian sm-mta[8129]: My unqualified host name (debian) unknown; sleeping for retry
Other symptoms incude Sendmail being very slow or hanging completely.
This error output actually makes the problem quite clear. The unqualified host name
text means exactly what it says. It means that Sendmail is not able to resolve your fully qualified domain name.
In our example, our system’s hostname is debian
. You can check yours with the hostname
command.
$ hostname debian
To begin troubleshooting, check the contents of your /etc/hosts
file. In our case the host name is “debian” is not a FQDN. To resolve this problem change /etc/hosts
:
From:
127.0.0.1 localhost 127.0.1.1 debian
To:
127.0.0.1 localhost.localdomain localhost debian 127.0.1.1 debian
Of course, substitute debian
with the actual name of your FQDN.
After you have made these changes, you can restart the sendmail service and try sending your email again.
$ sudo systemctl restart sendmail
Even with this fix, your email is unlikely to be delivered if you do not have a properly configured fully qualified domain name. This is a presrequisite that must be setup before you can expect sendmail to work. Such a setup would be outside the scope of this tutorial. However, you can always follow our guide on Configuring Gmail as a Sendmail email relay in order to use gmail or your own Google Apps account to send email from the Linux command line.
Closing Thoughts
In this tutorial, we learned about some troubleshooting tips for the sendmail unqualified host name
error on Linux. It basically boils down to a simple change inside the /etc/hosts
file, but this assumes that you have already purchased and configured your fully qualified domain name correctly. If this is out of your depth, it is also possible to configure your gmail account as a sendmail relay, as linked above.
via https://linuxconfig.org/sendmail-unqualified-hostname-unknown-sleeping-for-retry-unqualified-hostname