Introduction

In most hosting servers, emails sent by the user ‘nobody‘ are restricted to prevent spam and abuse. Many CMS applications use PHP mail functions, and when PHP runs under mod_php or without suEXEC, the mail is often sent as the user nobody.

When this restriction is enabled, outgoing emails generated by PHP scripts may be blocked by the server.


Prerequisites

  • Access to WHM
  • Root privileges on the server
  • Access to Exim mail logs for verification

Implementation

Step 1: Verify the Error in Exim Logs

You may notice the following entry in the Exim main log when the restriction is enabled:

root@x3 [/home/pgnowonl/public_html]# grep 1RsSjE-0030Z3-0w /var/log/exim_mainlog

2012-02-01 13:27:32 1RsSjE-0030Z3-0w <= nobody@abc.com U=nobody P=local S=1745

2012-02-01 13:27:32 1RsSjE-0030Z3-0w ** hemanth.presence@gmail.com R=checkspam2: Mail sent by user nobody being discarded due to sender restrictions in WHM->Tweak Settings

2012-02-01 13:27:32 1RsSjE-0030Z5-1n <= <> R=1RsSjE-0030Z3-0w U=mailnull P=local S=2620

2012-02-01 13:27:32 1RsSjE-0030Z3-0w Completed

This confirms that the email was blocked due to the “nobody” sender restriction.


Step 2: Disable the Restriction in WHM

Log in to WHM and navigate to:

WHM → Tweak Settings


Step 3: Locate the Mail Restriction Option

Find the following option:

Prevent “nobody” from sending mail

Description:

Prevent the user “nobody” from sending out mail to remote addresses.

(PHP and CGI scripts generally run as “nobody” if you are using mod_php or have suEXEC disabled.)


Step 4: Disable the Restriction

Set the option to:

Off

Then save the settings.


Step 5: Test Email Delivery

After saving the changes, test the PHP mail functionality again to confirm that emails are being delivered successfully.


Conclusion

If PHP-generated emails are being discarded with the message “Mail sent by user nobody being discarded due to sender restrictions in WHM->Tweak Settings,” disabling the Prevent nobody from sending mail option in WHM will allow emails sent by PHP scripts running as nobody to be delivered successfully.

Leave a Reply