news
Serverspace Technologies in the UAE: Launch of Falconcloud
JH
Joe Harris
February 27, 2021
Updated May 26, 2023

How to Set Up Cron Notifications to Email on CentOS 8

CentOS Linux Maintenance

Using another OS?

Select the desired version or distribution.

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.

crontab -e

Paste these lines there and enter your email address to receive notification.

MAILTO="recipient@domain.com"
SHELL=/bin/bash
HOME=/
* * * * * echo "Test email from cron"

The result of all configured tasks will be sent to the specified email address.

Test email notification from cron
Screenshot 1. Test email notification from cron.

If you don't receive any notifications, look in the Spam folder. You can also look at the email logs to see why.

cat /var/log/maillog

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.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 2
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.