We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Sendmail - problem sending to own domain when web host is not the mail host

thomas_nc asked
Medium Priority
Last Modified: 2013-12-17
I  recently set up a web server using mydomain.com.   I have a properly configured mail server for this domain that is hosted by a third party.

After installing sendmail, I can send messages to any domain but my own.  The message I'm getting in the mail log is "user unknown" because sendmail is treating mail sent to mydomain.com as local mail. How do I get sendmail to treat messages sent from the web server to mydomain.com like any other message?
Watch Question

1. Edit the /etc/mail/local-host-names file and remove "mydomain.com"
2. Edit /etc/hosts and remove "mydomain.com". You should have a host entry for the actual computer (server1.mydomain.com), but not just the domain name.


I updated the /etc/mail/.local-host-names file and that did the trick for sending the mail out, but now the mx servers are reporting that user@mydomain.com does not exist when looking at the Return-Path.

This is correct because the Return-Path root@mydomain.com is not a valid account.  How can I get the "Return-Path" set to something that my mail server will not try to validate on it's end as a local account?  Or, could there be something else going on?

I suppose the Return-Path would need to be root@server1.mydomain.com, but am not sure.  Here is the host info for the server, if that helps:

I have an entry in /etc/hosts:
server1.mydomain.com  xx.xx.xx.xx (the public IP addr)

..and in /etc/sysconfig:

Your return-path really just needs to be any email address with a valid domain. It's not going to check the user part, to see if there is an account created for that user, but it'll try to resolve the domain. Where are you seeing this "does not exist" error? Are you using the domain is right (not misspelled)? Does it have an MX record and associated A record in DNS?

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.