0

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.

Atif
  • 1
  • 1
  • 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 http://mxtoolbox.com/ does. – Alex Jan 18 '17 at 11:48

2 Answers2

0

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.

Slipeer
  • 3,295
  • 2
  • 21
  • 33
  • 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](http://serverfault.com/users/395728/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
  • For this necessary more information about how your program sends an e-mail. – Slipeer Jan 18 '17 at 13:13
0

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

Atif
  • 1
  • 1