There are many who, like me, have had problems with PHP's mail() function on OS X/OS X Server 10.2.x and sendmail. I think I've stumbled onto the solution. This IS working for me and hopefully will work. :-)
This all assumes you have sendmail running of course. I have a stock installation and the default sendmail settings (like others, trying to change sendmail proved unsuccessful in getting it to accurately pick up the FQDN -fully qualified domain name).
You must also make sure that your domain name server properly identifies your server with the IP address, or this probably won't work.
From your command line (with root privileges) enter the following:
Scroll down untill you see HOSTNAME. Make sure it says the following:
Save the changes. Then reboot. Sendmail should now pick up the correct FQDN!
One point that is VERY important to remember. You should make SURE that your web account users have SHARE points assigned and not specific paths for the location of their files. Changing the hostname above will affect the path!
Hope this helps!