Email (with msmtp)
We can configure our PiServer to send emails when systemd units fail. This can also be used to send emails in general.
It is important to note that
msmtp is very simple. So simple, that without a working internet connection sending emails will simply fail permanently.
TODO: Further explanation can be found https://qasimk.io/2018/linux-email/.
- Secret keys in the configuration is secured under the
- Only users in the
Residential IPs have very poor reputation amongst email providers, therefore we will use a third-party service to send emails, for example Sendgrid, or Gmail.
(In this example, we use Sendgrid.)
Install & Configuration
pacman -S --needed msmtp msmtp-mta
defaults aliases /etc/aliases port 587 tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt syslog on account sendgrid host smtp.sendgrid.net auth on user apikey password ACTUALAPIKEYHERE auto_from on maildomain em.example.com account default : sendgrid
gpasswd -a <YOU> mail printf "Subject: Hello World\n\Or rather just me.\n" | msmtp default
/etc/msmtprc \ /etc/aliases \