Recently, I have faced the below issue with a new Sendmail installation on a Linux system. While sending emails to a specific domain like [email protected] are showing the error “stat=User unknown“.
The issue was happening for a specific domain only. Sending emails to other domain were working properly.
The log file entries are looks like below:
Jan 7 08:36:04 tecadmin sendmail: 1078a4RD022497: from=www-data, size=679, class=0, nrcpts=1, msgid=
, [email protected] Jan 7 08:36:04 tecadmin sendmail: 1078a4RD022497: [email protected], ctladdr=www-data (33/33), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30679, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown Jan 7 08:36:04 tecadmin sendmail: 1078a4RD022497: 1078a4RE022497: DSN: User unknown
After troubleshooting the issue, we found that this happens because your domain name matches either your server’s hostname or a setting in Sendmail’s config file. In that case, we can configure Sendmail to force send emails to your actual mail server instead of itself.
Follow the below instructions:
/etc/mail/sendmail.mcand add the following lines at the end:
sudo vim /etc/mail/sendmail.mc
Add the following entries:
define(`MAIL_HUB', `domain.com.')dnl define(`LOCAL_RELAY', `domain.com.')dnl
Make sure to change your domain name end with the trailing dot!
- Now, run the sendmailconfig command, so that the changes take effect, and restart sendmail just to be 100% sure:
Press ‘Y’ for all confirmation prompted.
- Finally, restart the Sendmail service to apply changes.
sudo systemctl restart sendmail
All done. Again send an email and the email should be delivered to the actual mailbox.