Sendmail user unknown error

Posted August 26, 2015 18k views
Linux BasicsNginxUbuntuServer OptimizationEmailConfiguration ManagementLEMP


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.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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.

  • This has literally saved me after 4 days of rabbit holes. Thanks!

  • I created an account here only to say thank you for posting this solution. Just used it on photon OS on vCenter Server Appliance 6.7.

    If it helps someone else, here’s the commands I used to apply the changes:

    m4 m4/cf.m4 /etc/mail/ > /etc/mail/
    systemctl daemon-reload
    systemctl restart sendmail

    You’re a life saviour, thank you!