Sending an email to @example.com when the server is example.com

emailemail-servermx-record

I am a noob system admin and here is my case:

  1. I have a web application (example.com) installed on dedicated server. This application sends emails to clients successfully.
  2. I created a Google Business Mail "@example.com"
  3. I changed the MX records from my domain manager to point to Google Business Mail
  4. Now I can send and receive emails successfully from other mail services (hotmail, yahoo).
  5. When the application tries to send email to "@example.com" it fails.

I think it might be because the application server has the "example.com" domain defined in "hosts" file or something. So probably it directs the mail to itself.

How can I solve it, if possible.

UPDATE:
Output of using telnet to send email (http://thedaneshproject.com/posts/send-mail-through-smtp-using-telnet/)

RCPT TO: admin@example.com  
250 Accepted
DATA
354 Enter message, ending with "." on a line by itself
Test info
.
250 OK id=1RAPpZ-0005Kr-PO

Thanks,

Best Answer

Your server name should never be example.com. It should have a hostname. For example coolhost.example.com, mail.example.com, wael34218.example.com, milkyway.example.com, chubby.example.com or whatever you like. But never the domainname itself.

So change it to something valid in /etc/hostname, /etc/mailname and /etc/hosts. Restart your box and then we will see.