Recently, I have faced below issue with the fresh sendmail installation on an Linux system. While sending email to an specific domain like [email protected] are showing error “stat=User unknown“.
The issue was happening for 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:
- Edit /etc/mail/sendmail.mc and add the following lines at the end:
sudo vim /etc/mail/sendmail.mc
Add following entries:
define(`MAIL_HUB', `domain.com.')dnl define(`LOCAL_RELAY', `domain.com.')dnl
Make sure to change your domain name ended with the trailing dot!
- Run sendmailconfig 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 deliver to actual mailbox.