When Sendmail logs the message unable to qualify my own domain name (myhost) -- using short name
, it indicates the mail transfer agent can't properly resolve your server's fully qualified domain name (FQDN). This commonly occurs when:
- Your hostname isn't properly mapped in DNS
- The
/etc/hosts
file lacks proper entries - Domain search paths aren't configured correctly
Your current /etc/hosts
configuration shows:
127.0.0.1 localhost myhost.mydomain.eu myhost.domain2.eu localhost.localdomain 127.0.1.1 myhost
The issue stems from Sendmail not finding a matching FQDN for the short hostname myhost
in your second line.
Solution 1: Modify /etc/hosts (Recommended)
Update your hosts file to ensure proper FQDN mapping:
127.0.0.1 localhost localhost.localdomain 192.168.1.100 myhost.mydomain.eu myhost
Key points:
- Replace 192.168.1.100 with your actual server IP
- Place the FQDN first, then the short name
- Ensure reverse DNS matches this configuration
Solution 2: Configure Sendmail Directly
Edit /etc/mail/sendmail.mc
and add:
define(confDOMAIN_NAME', myhost.mydomain.eu')dnl define(confCF_VERSION', myhost.mydomain.eu')dnl
Then rebuild the configuration:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf service sendmail restart
After making changes, verify with:
hostname -f # Should return FQDN sendmail -d0.1 -bv root | grep Canonical # Check Sendmail name resolution dig -x your.server.ip # Verify reverse DNS
If issues persist, check:
/etc/host.conf /etc/nsswitch.conf /etc/resolv.conf
Ensure these files contain proper search domains and host resolution order (typically files dns
).
For a server with multiple domains:
# /etc/hosts 192.168.1.100 mail.mydomain.com mail mail-backup.mydomain.net # /etc/mail/sendmail.mc define(confDOMAIN_NAME', mail.mydomain.com')dnl define(confDONT_PROBE_INTERFACES', true')dnl
When Sendmail complains about being "unable to qualify my own domain name," it's indicating a fundamental DNS resolution problem. The mail transfer agent (MTA) can't properly map your server's hostname to a fully qualified domain name (FQDN).
Your current /etc/hosts
configuration shows:
127.0.0.1 localhost myhost.mydomain.eu myhost.domain2.eu localhost.localdomain
127.0.1.1 myhost
The key issue here is that myhost
appears without a domain qualification on the second line. Sendmail expects every host reference to be fully qualified.
Here's the correct way to structure your hosts file for Sendmail:
127.0.0.1 localhost localhost.localdomain
192.168.1.100 myhost.mydomain.eu myhost
Key requirements:
- Each host must have exactly one FQDN entry
- The short name should appear after the FQDN
- Never use 127.0.1.1 for your primary hostname
Verify and set your hostname properly:
# Check current hostname
hostname
hostname -f
# Set FQDN permanently (Debian/Ubuntu)
echo "myhost.mydomain.eu" > /etc/hostname
hostnamectl set-hostname myhost.mydomain.eu
# For CentOS/RHEL
echo "HOSTNAME=myhost.mydomain.eu" >> /etc/sysconfig/network
Add these to your /etc/mail/sendmail.mc
:
define(confDOMAIN_NAME', mydomain.eu')dnl
define(confCF_VERSION', myhost.mydomain.eu')dnl
Then regenerate your Sendmail configuration:
make -C /etc/mail
systemctl restart sendmail
Test your configuration with these commands:
# Verify forward resolution
host myhost.mydomain.eu
# Check reverse DNS
host 192.168.1.100
# Sendmail test mode
sendmail -bv root
For production systems, consider proper DNS setup:
# Example BIND zone entry
myhost IN A 192.168.1.100
100.1.168.192.in-addr.arpa. IN PTR myhost.mydomain.eu.
Remember to update your /etc/nsswitch.conf
to prioritize DNS:
hosts: files dns