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.
EDIT:
Using Ubuntu 16
/etc/hostname
is www-server.mydomain.com
/etc/hosts
contains:
127.0.0.1 localhost www.mydomain.com admin.mydomain.com
127.0.1.1 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)
EDIT 2:
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