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
354 Enter message, ending with "." on a line by itself
Test info
250 OK id=1RAPpZ-0005Kr-PO


  • 1
    I think it might be because the application server has the "example.com" domain defined in "hosts" file - Is it defined here or not? What OS are you hosting on? – Sam Cogan Oct 2 '11 at 17:13
  • 1
    Can you be more specific about the failure? Can you remove the hosts entry and send mail that way (thedaneshproject.com/posts/send-mail-through-smtp-using-telnet) ? Do you have a valid SPF record setup for your domain? Otherwise google will junk your mail probably (looked in your spam folder?) – polynomial Oct 2 '11 at 17:13
  • @polynomial the email is not in the spam, there are no errors written in the log file of the application. If I try to send emails to other domains it works perfectly. – wael34218 Oct 2 '11 at 17:19
  • @Sam I removed the host record and still not working. I am using CentOS – wael34218 Oct 2 '11 at 17:20
  • When you removed the record did you restart your MTA and/or application? Also can you add the output of using telnet to test mail from the machine to the question? – polynomial Oct 2 '11 at 17:24

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.


Examine the configuration of whatever SMTP engine the application is using. Chances are that when you changed the "example.com" mail to Google, you did not cascade the necessary changes into the SMTP engine.

Much depends on the SMTP engine, but I can think of a couple of possible adjustments ... there may be more you can try.

1/ Change it to be a sub-domain (webapp.example.com) of the main server, and make sure it's DNS can find example.com.

2/ It might need to be configured to authenticate to Google.

Also, the parameters which are passed from the app may need to be adjusted. It may also be worthwhile to simply reconfigure the SMTP engine, if it is separate from the main app.

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.