PHP邮件功能疑难解答

How do I troubleshoot PHP's mail function? The code below (obviously I have my actual email address in there) outputs ERROR and I DO NOT receive the message:

if(mail("email@address.com","test subject","test messaeg"))
    echo "SENT";
else
    echo "ERROR";

My php.ini has the default settings that CentOS 6.3 minimal is setup with:

SMTP = localhost
smtp_port = 25
sendmail_path = /usr/sbin/sendmail -t -i
mail.add_x_header = On

I tried the following via SSH, and it worked fine. I received the message to my gmail account:

echo "Body text." | mail -s "Hello world" email@adderss.com

Where should I go from here in troubleshooting this?

Figured it out...

Had to disable SELINUX using the instructions here: http://www.crypt.gen.nz/selinux/disable_selinux.html