When your Sendmail server suddenly starts rejecting sender addresses with "Domain not found" errors, it's typically not about your actual domain existence - it's about how your mail server identifies itself. The key insight comes from the error message showing bookings@debian70.vm
instead of your actual domain premiumconnect.co.za
.
The core issue lies in your Sendmail configuration where the hostname isn't properly set. Run these diagnostic commands:
hostname
hostname -f
sendmail -d0.4 -bv root | grep Canonical
You'll likely see output showing debian70.vm
instead of your proper domain. This causes Sendmail to use the wrong hostname when generating sender addresses.
First, ensure your system hostname is correct:
sudo hostnamectl set-hostname mail.premiumconnect.co.za
Then modify your Sendmail configuration files:
1. /etc/mail/sendmail.mc
dnl Define our official domain name
define(confDOMAIN_NAME', premiumconnect.co.za')dnl
dnl Set the masquerade domain
MASQUERADE_AS(premiumconnect.co.za')dnl
dnl Masquerade all sender addresses
FEATURE(masquerade_envelope')dnl
FEATURE(masquerade_entire_domain')dnl
2. /etc/mail/local-host-names
premiumconnect.co.za
mail.premiumconnect.co.za
debian70.vm
After making these changes:
sudo make -C /etc/mail
sudo systemctl restart sendmail
Verify your changes with these commands:
echo "Subject: Test" | sendmail -v youremail@gmail.com
tail /var/log/maillog
Check that the sender address now correctly shows your domain instead of the VM hostname.
While your MX records exist, consider these enhancements:
- Add a PTR record for your mail server's IP
- Configure SPF records:
v=spf1 mx ~all
- Set up DKIM signing for outgoing emails
Use these external tools to verify your setup:
dig premiumconnect.co.za MX
nslookup -q=ptr 196.28.97.202
telnet mail.premiumconnect.co.za 25
The complete solution should resolve both your immediate delivery issues and improve overall email deliverability.
Looking at your logs, I notice something peculiar - the receiving server is rejecting emails with the error "Sender address rejected: Domain not found" specifically for the address bookings@debian70.vm
, while your actual sending domain premiumconnect.co.za
appears to have proper MX records.
# This is what proper MX records should look like
dig premiumconnect.co.za MX +short
10 za-smtp-2.mimecast.co.za.
10 za-smtp-1.mimecast.co.za.
The key issue here is that your Sendmail server is identifying itself as debian70.vm
during the SMTP handshake (visible in the error message), while trying to send from @premiumconnect.co.za
. This mismatch triggers spam filters.
To verify your current HELO/EHLO name:
telnet localhost 25
EHLO example.com
Edit your Sendmail configuration file (typically /etc/mail/sendmail.mc
) and ensure these settings:
define(confDOMAIN_NAME', premiumconnect.co.za')dnl
define(confHELO_NAME', premiumconnect.co.za')dnl
define(confRECEIVED_HEADER', by $j ($v/$Z)$?r with $r$. id $i.$u')dnl
After making changes, rebuild and restart Sendmail:
sudo make -C /etc/mail
sudo systemctl restart sendmail
While not directly related to your current issue, implementing SPF will help with email deliverability:
# Example SPF record for your DNS
v=spf1 mx a:premiumconnect.co.za ~all
Use these commands to verify your settings:
# Check HELO name
sendmail -bt
> =w
> /map mailertable
> /quit
# Verify DNS resolution
dig premiumconnect.co.za ANY
1. Make sure your reverse DNS matches your forward DNS
2. Ensure your server's hostname is properly set in /etc/hostname
and /etc/hosts
3. Check that your domain's WHOIS information is up-to-date
# Example hosts file entry
127.0.0.1 localhost
196.28.97.202 premiumconnect.co.za debian70
For more complex setups where you need to rewrite sender addresses:
FEATURE(masquerade_envelope')dnl
FEATURE(masquerade_entire_domain')dnl
MASQUERADE_AS(premiumconnect.co.za')dnl
MASQUERADE_DOMAIN(premiumconnect.co.za')dnl
Remember to rebuild your Sendmail configuration after these changes:
cd /etc/mail
make