Anacron reports with sendmail by default. We need to configure a client if we want to have it deliver the report to us.
Install msmtp:
sudo apt install msmtp msmtp-mta
Configure /etc/msmtprc:
# Set default values for all following accounts.
defaults
# Use the mail submission port 587 instead of the SMTP port 25.
port 587# Always use TLS.
tls on# Set a list of trusted CAs for TLS. The default is to use system settings, but# you can select your own file.
tls_trust_file /etc/ssl/certs/ca-certificates.crt
# The SMTP server
account local
host zhtluo.com
from local@zhtluo.com
set_from_header on
user local@zhtluo.com
domain zhtluo.com
auth on# TODO: Replace here with your password
password replaceme
# Set default account
account default: local
# Map local users to mail addresses
aliases /etc/aliases
Note: It is not the best way to keep plain password in the file, but I did not find a good alternative. See also the documentation.
Add MAILTO to /etc/anacrontab:
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
HOME=/root
LOGNAME=root
MAILTO=local@zhtluo.com
# These replace cron's entries
1 5 cron.daily run-parts --report /etc/cron.daily
7 10 cron.weekly run-parts --report /etc/cron.weekly
@monthly 15 cron.monthly run-parts --report /etc/cron.monthly
Make sure everything works:
sudo anacron -fnd
Contact Information
Lawson Computer Science Building
305 N. University Street
West Lafayette, IN 47907-2107
United States of America
Institutional: luo401 [at] purdue [dot] edu
Personal: zhtluo [at] gmail [dot] com