Msmtp: Difference between revisions

From NixOS Wiki
imported>Cyounkins
m Use programs.msmtp.defaults.aliases instead of extraConfig
imported>Onny
m Minor cleanup
Line 1: Line 1:
[https://marlam.de/msmtp/ msmtp] is a basic email sender. It is easy to configure but lacks some features like queuing when offline.
[https://marlam.de/msmtp/ msmtp] is a basic email sender client. It is easy to configure but lacks some features like queuing when offline.
 
[https://search.nixos.org/options?query=programs.msmtp msmtp options list]


== Basic configuration with TLS connections ==
== Basic configuration with TLS connections ==
Line 41: Line 39:
};
};
</syntaxhighlight>
</syntaxhighlight>
== See also ==
* [https://search.nixos.org/options?query=programs.msmtp msmtp options list]
[[Category:Applications]]

Revision as of 13:43, 7 September 2022

msmtp is a basic email sender client. It is easy to configure but lacks some features like queuing when offline.

Basic configuration with TLS connections

programs.msmtp = {
  enable = true;
  accounts = {
    default = {
      auth = true;
      tls = true;
      from = "<from address here>";
      host = "<hostname here>";
      user = "<username here>";
      passwordeval = "cat /secrets/smtp_password.txt";
    };
  };
};

Note that msmtp has no daemon and runs as the invoking user. If using passwordeval, the file must be readable by any user that wishes to send mail.

Aliases

Example:

programs.msmtp.defaults = {
  aliases = "/etc/aliases";
};

environment.etc = {
  "aliases" = {
    text = ''
      root: me@example.com
    '';
    mode = "0644";
  };
};

See also