I did an apt-get update of a server "myserver.com" recently and now all emails sent from that server to email@myserver.com bounce with "user unknown". I believe that the server is trying to deliver to local users, but I am not sure why it changed to do this, or how to change it to send them correctly.

Any advice is welcomed! The messages are sent via the mail function in php.


Using Ubuntu 16

/etc/hostname is www-server.mydomain.com

/etc/hosts contains:   localhost www.mydomain.com admin.mydomain.com   mydomain

If I use sendmail on the commandline, I can send an email to myemail@gmail.com, or other email addresses, but I can no longer send to me@mydomain.com. With sendmail I don't know how to see what happens, but I have had users report emails sent to user@mydomain.com from my php based website bouncing back to the user with the message "user unknown".

If I send an email to me@mydomain.com from gmail, it works fine and I receive the email, so I know the problem is on this server

This all started happening after doing an apt-get upgrade (which had quite a few updates to do)


user@www-server:~# nslookup -query=mx mydomain.com
Server:     94.199.n.n
Address:    94.199.n.n#53

Non-authoritative answer:
mydomain.com    mail exchanger = 10 mail.mymailserver.com.

Authoritative answers can be found from:
mydomain.com    nameserver = ns2.domainprovider.com.
mydomain.com    nameserver = ns.domainprovider.com.
mail.mymailserver.com   internet address = 94.199.x.x
ns.domainprovider.com   internet address = 212.67.y.y
ns2.domainprovider.com  internet address = 62.138.z.z

Note: IP Address of this server is not mentioned in the nslookup output

closed as off-topic by Esa Jokinen, womble Oct 20 '17 at 5:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    You are missing a lot of important information and what is there is confusing. It's tough to provide an answer on this. First, "myserver.com" would not be the name of your server, as "myserver" is a second level domain and servers would never "properly" be named like that. Your server would be "myserver.mydomain.com." In addition, you didn't specify where your e-mail is hosted, if it is on the same server, you didn't specify what e-mail daemon you're using. You also didn't specify anything about what operating system, which versions of what applications you updated, etc. – Appleoddity Oct 20 '17 at 4:34
  • your e-mail would be email@mydomain.com. – Appleoddity Oct 20 '17 at 4:37
  • What IPs are you using for your DNS resolvers on this server? Why do you have a mydomain in your hosts file? What happens if you do an nslookup -query=mx mydomain.com Do you receive back the records for your email hosting provider? I can only assume, based on your information, that the e-mail is hosted off-site somewhere, or on another server? – Appleoddity Oct 20 '17 at 4:52
  • I have no idea why the is there, it was like that after the installation of the OS. I will add the output of nslookup to the main post in a second, but yes the records come back. Email is hosted on another server. – Ben Holness Oct 20 '17 at 4:58
  • Looks ok. See here if this helps: serverfault.com/questions/102647/… – Appleoddity Oct 20 '17 at 5:06

Browse other questions tagged or ask your own question.