2.11.1.2. The reports do not reach the recipient
If emails with reports sent in the usual waydo not reach the recipient, try organizing your own sending of reports using one of the methods described below.
Important points:
- Only what the command being executed will be sent to the mail.
- When using utilities
wget
andcurl
do not use the key-q
which suppresses the output.
Sending a report using SMTP
- Create a file named
report.php
in the root of the hosting account and place the script from instructionby specifying your data in it. - In the script, additionally replace the line:
$text = "Hi, checking the SMTP connection."; // содержимое отправляемого письма
Per line:
$text = shell_exec(addslashes($argv[1]) . " 2>&1");
- Add a cron task and specify the following command as a task:
/usr/local/bin/php -f /home/example/report.php "command"
- Instead
example
indicate title hostingaccount. - Instead
command
specify the command for which you want to receive reports.
- It is recommended to first run the command manually, connecting over SSH to make sure it works as intended.
Sending a report using sendmail
The method allows you to do without creating additional files.
- Add cron task, 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
command
specify the command for which you want to receive reports. - Message
cron script
this is the subject line of the email, you can replace it with your own. - Instead
sender@example.com
specify any domain mailbox directed to our hosting. - Instead
receiver@example.com
specify the mailbox of the recipient of the report.