Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

My original problem was that the PHP mail() function wouldn't work for programs on my server, which is running Centos 5.5.

I have configired the firewall through a program called system-config-securitylevel-tui and the SMTP port is now open.

sendmail is installed.

I've looked in my maillog and I've got the following message:

myhost sendmail[932]: My unqualified host name (myhost) unknown; sleeping for retry

Looking at this stackoverflow article I might need to make a change to my /etc/hosts file, but I'm not sure if my situation is the same as the above guys and I certainly don't know what I'm doing.

My hosts file looks like:     localhost localhost.localdomain     myhost (fake ip address)

From what I've read, I need to have a fully qualified domain name for the sendmail program to use.

Now I've set up my httpd webserver with the ServerName set to my domain name. How do I do the same sort of thing for the hosts file (ie how do I add the full domain name? Should the file just be:     localhost localhost.localdomain     myhost www.fulldom.tld

I don't want to run a mailserver on my server. I have a mail account set up. I just want the PHP function to work. Am I going in the right direction here do you think?

Many thanks

share|improve this question
up vote 1 down vote accepted

I added my full domain name to the second line as in the above example and I can now send mail.

share|improve this answer

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.