nichollsd

Member
Aug 18, 2006
9
0
151
Hi everyone,

On the new server I'm working on, I can't seem to get the php mail() function to work properly. It was working fine on my old server, but now that I'm on this dedicated server it's not working. Is there something I need to set up in cPanel or WHM to enable this function to work properly?

Thanks for any and all help you can give me!
 

rsaylor

Well-Known Member
Mar 27, 2003
160
1
168
make sure your hostname is valid and resolves. #1 reason for mail to fail to send.
 

nichollsd

Member
Aug 18, 2006
9
0
151
I'm sorry, I'm not quite sure what you mean by "hostname is valid and resolves". Sorry, but could you explain in a little more "newbie-friendly" terms?

Thanks!
 

rsaylor

Well-Known Member
Mar 27, 2003
160
1
168
Hi, in WHM you have to set a hostname for your server. For example: server.mydomain.com

A lot of people will use a fake name server. The name should be a verifiable name and should resolve. That's where I would check 1st.
 

nichollsd

Member
Aug 18, 2006
9
0
151
Ok, I've found what you're talking about but everything seems to be set up right. The thing is, another site on the same server uses the same code and works properly, but for this site the function is not working properly. Is there anything else I should be doing/checking?
 

rsaylor

Well-Known Member
Mar 27, 2003
160
1
168
you should then troubleshoot the mail logs,

tail -f /var/log/exim_mainlog

try sending a email, what error is logged. Look in /etc/httpd/logs/suexec_log , any errors for the site listed?

Are permissions correct?
 

nichollsd

Member
Aug 18, 2006
9
0
151
I've made sure register globals is on, I've checked everything else, and everything seems fine but it's still not working.

I've got 2 sites on the same server, and the function works on one of the sites but not on the other. would it have something to do with how I set the site up (the one I set up is the one where the php mail function isn't working, someone else set up the other site).

I'm really stumped on this...if anyone has any more suggestions I could really use them!

Thanks again!
 

kistler

Well-Known Member
Jan 27, 2005
136
0
166
Dennisb1 said:
its with php security
open php.ini and look for a line
Code:
register_globals
And make sure its turned on! when its off you cant send mail with php
Php have register_globals a while ago turned off in there new installations read at:
www.php.net/register_globals

Good luck ;)

Is this true? as far as I know it should send with it off or on - I would tail your server:

tail -f /var/log/exim_mainlog

When you send mail using php it or something should show up there and will let you know why it stopped.

Another thing is if you dont have phpsuexec it will send as nobody, you may have it disabled in WHM and if you dont sometimes you'll find that some other host will not like this. If you dont have phpsuexec installed I would do so.
 
Last edited:

kistler

Well-Known Member
Jan 27, 2005
136
0
166
if it comes from "nobody" (if phpsuexec is not installed right) it more then likely will – Sometimes if that domain is not hosted at your server/ip it maybe marked as spam also do you have an rDNS setup on your ip?