SDB:Howto-systemd-status-mail
systemd-status-mail is a systemd-service that informs you about events, for example a broken update on an unattended MicroOS-Server.
Situation
You want to use systemd-status-mail in a minimalistic way (no MTA like postfix set-up) and use an external mail provider.
Procedure
You need to install mailx in case it is not installed by default (e.g. on MicroOS systems)
systemd-status-mail installs the vendor configuration file /usr/etc/default/systemd-status-mail
You should create a file /etc/default/systemd-status-mail with your settings.
Configuration
When using a mail service provider like GMX, gmail or other, several checks are applied to avoid the abuse for spam deliveries. systemd-status-mail needs to be configured properly in order to pass these checks. The configuration is described using GMX as example.
Apply the required settings in /etc/default/systemd-status-mail
- ADDRESS=“root@localhost”
Address to which the status mail should be send. Set as required.
- FROM=“john.doe@gmx.net”
Sender address of the status mail. Make sure it is a valid sender address with your mail provider!
- MAILER=“mailx”
You want to use that setting.
- RELAYHOST=“smtp.gmx.net”
Mail relay used by mailx(1) if specified and not empty.
- MAILX_OPTIONS="-Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user='john.doe@gmx.net' -Ssmtp-auth-password='TopSecret' "
MAILX_OPTIONS contains the necessary parameters to have the status mail accepted by the mail provider
Final steps
Finally you need to tell the system on which event the status mail should be triggered. See the example in the man-page.