How to Set Up Cron Notifications to Email on CentOS 8
We recently looked at Cron configuration on CentOS 8. It has another useful option, and we'll talk about it now. In this tutorial, we will set up sending Cron notifications to email on CentOS 8.
Before cron can send email notifications, you need to configure an SMTP server. We covered Postfix configuration in this tutorial.
Cron configuration
To enable sending cron notifications to email, open the cron scheduler.
Paste these lines there and enter your email address to receive notification.
SHELL=/bin/bash
HOME=/
* * * * * echo "Test email from cron"
The result of all configured tasks will be sent to the specified email address.
If you don't receive any notifications, look in the Spam folder. You can also look at the email logs to see why.
Some mail servers have such strict spam checks that additional outgoing server settings are required. For example, adding a DNS PTR record for the domain name. To do this, you need to contact the support team of the company that provides you with a public IP address.
Additional measures to increase trust in correspondence from your server are to enable DKIM signature for your messages, add SPF and DMARC records for your domain.