User cron notifications: Problem and possible fix

When installing Hestia using the defaults, users might miss notifications coming from the cron daemon.

For example, let’s suppose we have created the user with name: user1 on the Hestia server with name server1.example.com. Since there is no MAILTO variable defined, email notifications will be sent to the owner of the crontab (as explained in the crontab man page).

The good question here is: How is the owner’s address defined?

According to this answer, the address (where the notifications will be sent) is composed by the username followed by the contents of /etc/mailname So in this example, the notifications will be sent to [email protected] (I have tested that on clean installation of Hestia 1.0.6)

But in the default installation of Hestia, the server’s Mail Domain is not created, so the notifications will be dropped/ignored like this:

2020-01-28 08:15:01 1iwK9N-0003ae-RH <= <> R=1iwK9N-0003aO-NY U=Debian-exim P=local S=1939
2020-01-28 08:15:01 1iwK9N-0003ae-RH remote host address is the local host: server1.example.com
2020-01-28 08:15:01 1iwK9N-0003ae-RH == [email protected] R=dnslookup defer (-1): remote host address is the local host
2020-01-28 08:15:01 1iwK9N-0003ae-RH ** [email protected]: retry timeout exceeded
2020-01-28 08:15:01 1iwK9N-0003ae-RH [email protected]: error ignored
2020-01-28 08:15:01 1iwK9N-0003ae-RH Completed

To test the above, create a cron job that is producing some output.

I believe this problem can be solved in two different ways:

  1. Assign a MAILTO variable in each user’s crontab file, with the value of the user’s email address (as defined when creating the Hestia user).
  2. By default create a mail domain with the same name as the Hestia server and when a new user is created, create a mailbox on that Mail Domain that’s forwarding all email to the user’s email address (as defined when creating the Hestia user).
1 Like

Hi Felix

Thanks for your detailed post, this should already be implemented with the following line: https://github.com/hestiacp/hestiacp/blob/cfd72dd1b6f199a40b97d93a84e09cce626fb827/func/main.sh#L553

This sets the mailto address to the user contact if cron reports are enabled.

2 Likes