Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»Sendmail User Unknown Error (Resolved)

    Sendmail User Unknown Error (Resolved)

    By RahulJuly 27, 20222 Mins Read

    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“.

    Advertisement

    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[22497]: 1078a4RD022497: from=www-data, size=679, class=0, nrcpts=1, msgid=, [email protected]
    Jan  7 08:36:04 tecadmin sendmail[22497]: 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[22497]: 1078a4RD022497: 1078a4RE022497: DSN: User unknown
    

    Solution:

    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:

    1. Edit /etc/mail/sendmail.mc and 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!

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

      Press ‘Y’ for all confirmation prompted.

    3. 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.

    error sendmail
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Split Large Archives in Linux using the Command Line

    System.out.println() Method in Java: A Beginner’s Guide

    sleep Command in Linux with Examples

    View 1 Comment

    1 Comment

    1. AnthonyK on July 27, 2022 2:28 am

      Interesting. I’ve been using email sendmail since 2005 and have not had these 2 entries in my sendmail.mc file.

      The this week after patching server (which I do regularly), the relay stopped working and it was only after I found your article and added the fix you suggest here that it started working again. Very odd that I’ve escaped this issue for so long!

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to Split Large Archives in Linux using the Command Line
    • System.out.println() Method in Java: A Beginner’s Guide
    • Split Command in Linux With Examples (Split Large Files)
    • Test Your Internet Speed from the Linux Terminal
    • 11 Practical Example of cat Command in Linux
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.