Sendmail user unknown error

August 26, 2015 10.3k views
Ubuntu Nginx Configuration Management Server Optimization LEMP Linux Basics Email


sendmail is set up correctly. Emails arrive at email addresses other than my domain or host name.

Is it possible to ignore – or something like that – the local host/domain?

System: Ubuntu 15.04 with LEMP stack.

1 Answer

Hi! I know this was posted a while ago but I hope this helps anyone who is experiencing the same issue and happens to come across this question in the future:

This happens by default because your domain name matches either your server’s hostname or a setting in sendmail’s config file. You can force sendmail to send emails to your actual mail server instead of itself by following these steps:

  1. Edit /etc/mail/ and add the following lines at the end:

    define(`MAIL_HUB', `')dnl
    define(`LOCAL_RELAY', `')dnl

    Make sure you including the trailing dot!

  2. Run sendmailconfig so that the changes take effect, and restart sendmail just to be 100% sure:

    sudo sendmailconfig  
    sudo service sendmail restart

Once you’ve done that, try sending an email to the same domain and you should see sendmail connecting to your domain’s incoming mailserver(s) in the log file.

Have another answer? Share your knowledge.