If your PHP script is not sending emails when run as a cron job in cPanel, there could be several reasons for this. Here are some steps to diagnose and fix the issue.

Step 1:

Use Track Delivery to check email sending logs for your account. If the email was sent successfully but was not received it may have been blocked or marked as spam by the recipient. How-to use Track Delivery to check if your emails arrived

Step 2:

Test your script runs without errors by manually invoking it from Terminal. How to Run a PHP Script in Terminal in cPanel

Step 3:

If your cron job command is using /usr/local/bin/php try changing it to use wget instead. For example:

wget -q -O - https://example.com/cron/mycronscript.php >/dev/null 2>&1

Troubleshooting issues with PHP scripts not sending emails when run as a cron job can be a complex task, but by following the steps outlined in this article, you should be able to diagnose and resolve the problem.