Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a Drupal website on a Linux server, it is using mail() to send mail through PHP. I think that would be using PHPmailer and sendmail.

Domain is and we can receive email from the website all day long. To our email, to our Gmail, everything is great.

However, they cannot receive any email from the web server. Email is being sent as

They are running Exchange I believe and we have an SPF record in place but that doesn't seem to be helping at all.

How can I best simulate sending an email from the server, and testing what their mail server is responding with. What tools can I use to see some logs, or get to the root of this issue? I am not getting much help from their Exchange admin, doesn't appear that it is ever hitting their Exchange so something before it may be squashing it.. Barracuda, who knows.

share|improve this question
up vote 4 down vote accepted

When I have seen this happen, it is almost always because the mail is being delivered locally. Your Drupal web server hosting does not know that's email is being hosted externally.

You should be able to quickly verify this by looking at the /var/log/maillog or mail.log or exim_main.log or whatever the mail log is named in your distro.

Another very useful tool is telnet. You can telnet from your Drupal server into your Exchange server and simulate an SMTP connection. This will let you see what messages the Exchange server is sending back and will also verify if you can, indeed, get proper email delivered to that Exchange server.

A good quick tutorial on how to do a manual SMTP session via telnet is here:

Good luck!

share|improve this answer
Outstanding! You were correct with it not being sent off the box. Hasn't happened with other clients on that machine but was certainly the issue. Thanks – Ryan Doom Dec 16 '11 at 15:52
Happy to help. It's a silly error that happens a LOT, but it's really non-obvious what is happening at first. – jdw Dec 16 '11 at 15:54

The telnet approach mentioned in jdw's answer is the preferred method, especially since you can initiate it directly from the sending server. The other thing to check is whether you have a reverse PTR record on the server's public/outgoing IP.

share|improve this answer

See also mail hosted at Google, web server elsewhere

share|improve this answer
We really do prefer that answers have content, not pointers to content. This may theoretically answer the question however, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Iain Dec 17 '11 at 8:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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