Can’t receive email from web server from the same domain

If you are using 1 domain and 2 different servers for email and web, you will have the issue from the web server, because you can't receive any emails from your webserver.

The root problem could be your server is considering your domain email accounts as local accounts, you can solve that issue by some methods.

– If you are using Sendmail, you can read these posts:

– If you are using Postfix, you can do this:

  1. connect to your server via ssh.
  2. edit your file :

nano /etc/postfix/

  1. comment the following line with # :

# mydestination = ...

  1. add at the end of the document :

mydestination =

  1. reload your postfix configuration by running :

/etc/init.d/postfix reload


– If you are using Cpanel:

Adding the MX records into the cPanel.

  1. Enter into the cPanel
  2. Go the the cPanel Mail section
  3. Search for MX Entry Maintenance, sometimes there is no text above the icon.
  4. Select the related domain
  5. Change Email Routing to Remote Mail Exchanger.
  6. Add all the google MX records as they are in your domain configuration using the appropriate priority values. You can check the records here and priorities
  7. Double check that Remote Mail Exchanger. is selected.

With this setting I was able to send email using mail PHP function to an email account inside the same domain as my website.

Google App instructions talking about MX records


After you did the above solution but it still doesn't work, you will need to update the resolv.conf file. It locates at /etc/resolv.conf 

You can replace all content in that file by this:


After that, you need to restart the Network Manager service by this command:

service NetworkManager restart

Hope it will help you ^^


No comments yet.

Leave a Reply