Why Do I Get Emails for Cron Jobs

Hosting Control Panel | Updated March 2026

Every time a cron job runs on your Ultra Web Hosting account, any output it produces gets emailed to you. If your cron jobs run frequently, this can flood your inbox with dozens of messages per day. This guide explains why it happens and how to control it.

Quick Answer

Add >/dev/null 2>&1 to the end of your cron command to suppress all output and stop the emails. If you want to keep a record of the output, redirect to a log file instead: >/home/user/cron.log 2>&1

01. Why Cron Jobs Send Email

This is standard Linux behavior, not a bug. The cron daemon captures anything your command writes to standard output (stdout) or standard error (stderr). If there is any output at all, cron emails it to the account owner. This includes:

PHP notices and warnings - Even if your script works correctly, PHP may output deprecation notices or strict standards warnings that trigger an email.

Script output - If your PHP script uses echo or print statements, that text becomes cron email content.

Error messages - If the command fails (wrong path, permission denied, syntax error), the error message gets emailed.

WordPress cron output - Running wp-cron.php via a system cron often produces HTML output that fills your inbox.

02. Suppressing All Output

The most common solution is to discard all output so cron has nothing to email. Add this to the end of your cron command:

/usr/local/bin/php /home/username/public_html/cron_script.php >/dev/null 2>&1

Here's what each part does:

>/dev/null redirects standard output (normal messages) to the null device, which discards it. 2>&1 redirects standard error (error messages) to the same place as standard output, which is already going to /dev/null. The result is that nothing gets captured and no email is sent.

Warning

Suppressing all output means you won't know if your cron job fails. If the task is important (backups, billing, data processing), consider logging to a file instead so you can review errors when needed.

03. Redirecting Output to a Log File

A better approach for important cron jobs is to redirect output to a log file. This stops the emails while preserving a record you can check:

/usr/local/bin/php /home/username/public_html/cron_script.php >/home/username/cron.log 2>&1

This overwrites the log file each time the cron runs. If you want to keep a running history instead, use the append operator (>>):

/usr/local/bin/php /home/username/public_html/cron_script.php >>/home/username/cron.log 2>&1
Tip

If you use the append operator, the log file will grow indefinitely. Consider adding a date stamp or setting up a separate cron job to truncate the log periodically. Place the log file outside of public_html so it's not web-accessible.

04. Changing the Email Recipient

If you want to keep receiving cron output but send it to a different address (or stop it entirely), you can set the MAILTO variable. In cPanel's Cron Jobs interface, there's a "Cron Email" field at the top of the page.

To change the recipient: Enter a different email address in the Cron Email field.

To disable emails for all cron jobs: Leave the Cron Email field empty and click "Update Email." This adds MAILTO="" to your crontab, which suppresses emails for every cron job on the account.

If you're comfortable editing the crontab directly via SSH, you can add this line at the top:

MAILTO=""

This affects all cron jobs below it. You can also set different recipients for different jobs by placing MAILTO="address@example.com" between entries.

05. Getting Emails Only for Errors

The most practical setup for production cron jobs is to suppress normal output but still receive emails when something goes wrong. Redirect only stdout to /dev/null while leaving stderr alone:

/usr/local/bin/php /home/username/public_html/cron_script.php >/dev/null

Notice there's no 2>&1 at the end. This means normal output is discarded, but error messages still get emailed to you. This is the best balance between inbox peace and error awareness.

Note

This only works if your script properly separates normal output from error output. PHP scripts that use echo for both status messages and errors will still generate emails for non-error output. Well-written scripts should use error_log() for errors and echo for status.

06. Setting This Up in cPanel

To add output redirection to an existing cron job in cPanel:

  1. Log in to cPanel - Go to my.ultrawebhosting.com and open cPanel for your hosting package
  2. Open Cron Jobs - Under the "Advanced" section, click "Cron Jobs"
  3. Find your existing cron job - Scroll down to "Current Cron Jobs" and click "Edit" next to the job you want to modify
  4. Add the redirect - Append >/dev/null 2>&1 to the end of the Command field
  5. Save - Click "Edit Line" to save the changes

For a complete guide on creating and managing cron jobs, see our cron job setup guide.

Need Help With Cron Jobs?

If your cron job isn't running as expected or you need help setting up the right schedule, our support team can take a look.

Open a Support Ticket

Quick Recap: Controlling Cron Job Emails

  1. Suppress all output - Add >/dev/null 2>&1 to the end of your cron command
  2. Log instead of email - Redirect to a file with >/home/user/cron.log 2>&1
  3. Disable all cron emails - Set the Cron Email field to empty in cPanel
  4. Errors only - Use >/dev/null without 2>&1 to only get emailed on errors
  5. Keep logs manageable - Use overwrite (>) or periodically truncate append (>>) logs

Last updated March 2026 · Browse all Hosting Control Panel articles

  • 501 Users Found This Useful

Was this answer helpful?

Related Articles

html or htm parsed as shtml not working

General | Updated 2026 If you have configured your server to parse .html or .htm files as...

How can I turn off directory indexing?

General | Updated 2026 If visitors can browse a list of files in your directories by going to...

Adding HTML to Site Builder

Obsolete Feature | 2026 This Feature Has Been Retired The legacy cPanel Site Builder has...

Meta Redirect

General | Updated March 2026 A meta redirect uses an HTML meta tag to automatically send...

Some visitors in China and Russia cannot reach my website

General | Updated 2026 If visitors in certain countries (commonly China, Russia, or other...



Save 30% on web hosting - Use coupon code Hosting30