changing nobody when emailing through php

epanagio

Well-Known Member
May 26, 2012
50
1
58
cPanel Access Level
Website Owner
I am using php to send emails to myself when my users take take certain actions. Those emails used to come to me via nobody@hostname.

After reading cpanel documentation about making my server more secure I disabled emails from user nobody. Is there a way to change php's way of determining the user ID?

In the php code to send the email I specify:
$headers .= "From: <evan@my-domain>" . "\r\n";
but the exim_mainlog says
Mail delivery failed: returning message to sender" for nobody@...
Thanks,
Evan
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,267
463
Hello :)

Do you have root access to this system? If so, you can update your PHP handler to suPHP so that email is sent as the account username rather than the "nobody" username. The other alternative is to modify your script to use SMTP authentication to send out email.

Thank you.
 

epanagio

Well-Known Member
May 26, 2012
50
1
58
cPanel Access Level
Website Owner
I do have root access but I can't figure out the "suPHP" part. Where do I change this?

I looked in the "php configuration editor" and I didn't see anything of interest there.

Hello :)

Do you have root access to this system? If so, you can update your PHP handler to suPHP so that email is sent as the account username rather than the "nobody" username. The other alternative is to modify your script to use SMTP authentication to send out email.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,267
463
You can change your PHP handler via:

"WHM Home » Service Configuration » Configure PHP and suEXEC"

Here are the considerations you should take into account before switching to suPHP:

cPanel - suPHP Considerations

Thank you.