Msmtp: Difference between revisions
m Fix typo and formatting Tags: Mobile edit Mobile web edit |
→Configuration: merged from zfs article |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
[https://marlam.de/msmtp/ msmtp] is | [https://marlam.de/msmtp/ msmtp] is an easy to configure basic email sender client with fairly complete sendmail compatibility. | ||
== Installation == | == Installation == | ||
| Line 36: | Line 36: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | |||
enable = true; | age.secrets.msmtp = { | ||
file = "${inputs.self.outPath}/secrets/msmtp.age"; | |||
}; | |||
# for zed enableMail, enable sendmailSetuidWrapper | |||
services.mail.sendmailSetuidWrapper.enable = true; | |||
programs.msmtp = { | |||
enable = true; | |||
setSendmail = true; | |||
defaults = { | |||
aliases = "/etc/aliases"; | |||
port = 587; | |||
auth = "plain"; | |||
tls = "on"; | |||
tls_starttls = "on"; | |||
}; | |||
accounts = { | |||
default = { | |||
host = "smtp.mail.example.com"; | |||
passwordeval = "cat ${config.age.secrets.msmtp.path}"; | |||
user = "myname@example.com"; | |||
from = "myname@example.com"; | |||
}; | |||
}; | }; | ||
}; | }; | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 56: | Line 70: | ||
=== Aliases === | === Aliases === | ||
Then, configure an alias for root account. With this alias configured, all mails sent to root, such as cron job results and failed sudo login events, will be redirected to the configured email account. | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | |||
environment.etc.aliases.text = '' | |||
root: admin@example.com | |||
''; | |||
environment.etc | } | ||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||