How to check cronjob mail using cmd

To check the cron job mail using the command line, you can use the following commands:

Method 1: Using mail command

  1. Open a terminal or command prompt.
  2. Type mail and press Enter. This will display the mail queue.
  3. Look for the cron job mail by searching for the word "cron" or the name of the script that runs the cron job.
  4. Use the q command to quit the mail reader.

Example:

$ mail
> q

Method 2: Using mailq command

  1. Open a terminal or command prompt.
  2. Type mailq and press Enter. This will display the mail queue.
  3. Look for the cron job mail by searching for the word "cron" or the name of the script that runs the cron job.
  4. Use the q command to quit the mail reader.

Example:

$ mailq
> q

Method 3: Using less command

  1. Open a terminal or command prompt.
  2. Type less /var/mail/username (replace username with your actual username) and press Enter. This will display the mail file.
  3. Search for the cron job mail by pressing / and then typing "cron" or the name of the script that runs the cron job.
  4. Use the q command to quit the less pager.

Example:

$ less /var/mail/username

Method 4: Using fetchmail command

  1. Open a terminal or command prompt.
  2. Type fetchmail and press Enter. This will fetch the mail from the mail server.
  3. Look for the cron job mail by searching for the word "cron" or the name of the script that runs the cron job.
  4. Use the q command to quit the mail reader.

Example:

$ fetchmail
> q

Note: The above commands assume that you are using a Linux or Unix-like system. The commands may vary depending on your operating system and mail server configuration.