2.12.1.2. Reports do not reach recipient

If messages with reports are sent in the usual way, but do not reach the recipient, try organizing your own sending of reports via SMTP or using sendmail, as described below.

Important points:

  • Only the output of the executed command will be sent to the mail.
  • For the wget and curl utilities, do not use the -q key, which suppresses output.
  1. Create a file named report.php in the root directory of your hosting account and place the script from instruction in it, specifying your details.
  2. In the script, additionally replace the line:
    $text = "Hello, checking the SMTP connection."; // contents of the message being sent

    With the line:

    $text = shell_exec(addslashes($argv[1]) . " 2>&1");
  3. Add a cron task and specify the following command as the task:
    /usr/local/bin/php -f /home/example/report.php "command"
    • Instead of example, specify the name of the hosting account.
    • Instead of command, specify the command for which you want to receive reports.
  4. Run a test launch of the task to make sure everything works as intended.
When using sendmail, you can avoid creating additional files.
  1. Add a cron task and specify the following command as the task:
    OUTPUT=$(command);echo -e "Subject:cron report\n${OUTPUT}" | sendmail -f "sender@example.com" -t "receiver@example.com"
    • Instead of command, specify the command for which you want to receive reports.
    • The text cron script is the subject of the message (you can replace it with your own).
    • Instead of sender@example.com, specify any mailbox that is serviced on our hosting.
    • Instead of receiver@example.com, specify the email of the report recipient.
  2. We strongly recommend to configure SPF and DMARC policies for the mailbox domain used as the sender.
Content