58 lines
1.2 KiB
Markdown
58 lines
1.2 KiB
Markdown
# 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
|
|
|
|
apt install msmtp msmtp-mta
|
|
touch /var/log/msmtp.log
|
|
chown root: /var/log/msmtp.log
|
|
chmod 600 /var/log/msmtp.log
|
|
|
|
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
|
|
|
|
```
|