I have moved recently my website to a VPS everything working well except for the email.

Emails are delivering well on any domain other than the domain where website is hosted. E.g. emails are sent to @gmail.com @yahoo.com or @anyotherdomain.com. But on domain www.mywebsite.com this is where website is hosted and if i send email like sale@mywebsite.com I got bounce back stating "Unknown user: sale"

Please help me in fixing this problem. I am thinking this could be MX record issue but I am not sure.

For email service I am using office 360.

  • Check if your MX records are pointing to your new VPS. – Alex Jan 18 '17 at 10:36
  • Thanks for your comments I have not changed the MX records, on the domain I just change the A record to new server IP and website is pointing to new server now. But for the email we are not using VPS email service we are using office 360 so I believe I don't need to change the MX records? @Alex – Atif Jan 18 '17 at 11:16
  • indeed. if you are using office 365 as your email service, probably your MXs are pointing to the right place. Does your app uses the built-in mail function? you should check if host -t mx mywebsite.com, issued on your VM outputs the same results as mxtoolbox.com does. – Alex Jan 18 '17 at 11:48

How do you send emails that do not reach? From the same web site or from an external system?

If you have email delivery problems from external systems, and little experience in the administration of mail systems, then you can quickly identify common problems using mxtoolbox.com or similar service.

  • Well the problem is with the same site I have created a example.com/testemail.php?email@gmail.com (this works fine) but on the same domain i.e. example.com/testemail.php?email@example.com (this doesn't work) – Atif Jan 18 '17 at 11:35
  • 1
    @Atif In this case you need to check you local MTA logs and configuration. But you dont specify what MTA you use on your ubuntu server. – Slipeer Jan 18 '17 at 11:38
  • I don't have MTA, I just enabled SMTP to enable emails – Atif Jan 18 '17 at 11:50
  • then you need to debug your SMTP component. – Slipeer Jan 18 '17 at 11:53
  • sorry can you explain me in more details I can submit error logs here? – Atif Jan 18 '17 at 12:09

I got the issue, it was issue with postfix server understand email as local user so it decline everything. I need to change etc/postfix/main.cf from mydestination = mydomainname.com, username, localhost.localdomain, localhost mydestination = username, localhost.localdomain, localhost So only issue was to remove the domain-name then you need to restart postfix service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.