2020-07-31 23:58:01 +00:00
|
|
|
# Email Notifications
|
|
|
|
|
|
|
|
The below commands will setup ```msmtp``` as an emailer for the system. This is helpful for getting system messages via email as well as cron emails.
|
|
|
|
|
|
|
|
This is optional but strongly recommended to setup.
|
|
|
|
|
|
|
|
## Important Notes
|
|
|
|
|
|
|
|
* ```msmtp``` *will* work with Office365, Gmail and other providers
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
``` sh
|
|
|
|
|
2020-08-03 16:03:07 +00:00
|
|
|
apt install msmtp msmtp-mta
|
2020-07-31 23:58:01 +00:00
|
|
|
|
|
|
|
cat > /etc/aliases <<EOF
|
|
|
|
# Example aliases file
|
|
|
|
|
|
|
|
# Send root to Joe and Jane
|
|
|
|
root: user@domain.tld
|
|
|
|
|
|
|
|
# Send cron to Mark
|
|
|
|
cron: user@domain.tld
|
|
|
|
|
|
|
|
# Send everything else to admin
|
|
|
|
default: user@domain.tld
|
|
|
|
EOF
|
|
|
|
cat > /etc/msmtprc <<EOF
|
|
|
|
# Accounts will inherit settings from this section
|
|
|
|
defaults
|
|
|
|
auth on
|
|
|
|
tls on
|
|
|
|
tls_trust_file /etc/ssl/certs/ca-certificates.crt
|
|
|
|
|
|
|
|
logfile /var/log/msmtp.log
|
|
|
|
|
|
|
|
from user@domain.tld
|
|
|
|
keepbcc on
|
|
|
|
|
|
|
|
account piframe
|
|
|
|
host email.domain.tld
|
|
|
|
port 587
|
|
|
|
auth on
|
|
|
|
user user@domain.tld
|
|
|
|
password apassword
|
|
|
|
|
|
|
|
# Set a default account
|
|
|
|
account default : piframe
|
|
|
|
|
|
|
|
aliases /etc/aliases
|
|
|
|
EOF
|
|
|
|
|
|
|
|
```
|