Replace ssmtp with msmtp

This commit is contained in:
coolneng 2022-06-06 23:13:38 +02:00
parent 1260e3ba3c
commit f5966c6271
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 32 additions and 10 deletions

View File

@ -1,23 +1,45 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with pkgs;
{ {
# Notify when a disk starts going haywire # Notify when a disk starts going haywire
services.smartd = { services.smartd = {
enable = true; enable = true;
notifications.mail = { notifications.mail = {
enable = true; enable = true;
recipient = "akasroua@gmail.com"; sender = "akasroua+smartd@disroot.org";
recipient = "akasroua@disroot.org";
mailer = "${msmtp}/bin/msmtp -t --read-envelope-from";
}; };
}; };
# Enable trivial MTA for smartd notifications # Notify about zpool problems
services.ssmtp = { services.zfs.zed = {
enable = true; enableMail = false;
useTLS = true; settings = {
useSTARTTLS = true; ZED_EMAIL_ADDR = "akasroua+smartd@disroot.org";
domain = "gmail.com"; ZED_EMAIL_PROG = "mail";
hostName = "smtp.gmail.com:587"; ZED_EMAIL_OPTS = "-s '@SUBJECT@' @ADDRESS@";
authUser = "akasroua@gmail.com"; ZED_NOTIFY_VERBOSE = false;
authPassFile = "/var/keys/ssmtp";
}; };
};
# Set up msmtp as notifier
programs.msmtp = {
enable = true;
defaults = {
port = 587;
tls = true;
};
accounts = {
default = {
auth = true;
host = "disroot.org";
user = "akasroua@disroot.org";
passwordeval = "${coreutils}/bin/cat ${config.age.secrets.msmtp.path}";
};
};
};
} }