Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

127.0.0.1     localhost localhost.localdomain
78.227.199.181     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:

127.0.0.1     localhost localhost.localdomain
78.227.199.181     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

1 Answer 1

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

 
discard

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.