Where Is the msmtp Config File?
msmtp reads ~/.msmtprc first, then the XDG config path, with system defaults under /etc. Search order and permission rule.
Last updated
msmtp resolves its config in a fixed order: ~/.msmtprc first, then $XDG_CONFIG_HOME/msmtp/config, with the system file (usually /etc/msmtprc) underneath and -C overriding everything. User accounts beat system accounts when both define them. Check msmtp --version to confirm the compiled paths on odd builds.
The hard rule is permissions: the user config must be readable and writable by owner only, or msmtp exits rather than risk leaking passwords. Queued mail defaults to ~/.msmtpqueue when queue scripts are in play. Passwords belong in passwordeval GPG helpers, not plaintext. Pair it with NeoMutt or Mutt as the sending half. Linux and Unix tooling.
Where msmtp stores this, by platform
~/.msmtprc
~/.msmtprc wins; $XDG_CONFIG_HOME/msmtp/config is second; system file usually /etc/msmtprc underneath. Must be chmod 600 or msmtp refuses to run. Override per-invocation with -C. Queue scripts default to ~/.msmtpqueue. Confirm compiled paths with msmtp --version on unusual builds.
Frequently asked questions
how do i move msmtp to a new computer
Copy ~/.msmtprc or ~/.config/msmtp/config to the new machine and set chmod 600 immediately. Password helpers (GPG files, pass entries) must move too or sending fails on auth. The queue directory moves with the scripts that reference it. Test with a probe message before wiring it into your mailer.
why does msmtp refuse to start
The file is group- or world-readable. msmtp refuses to run until only the owner can read and write it: chmod 600 on the file. This trips up everyone restoring from backups that flatten permissions. The system config has no such requirement, but user configs with passwords do.
how do i use msmtp as sendmail
Point sendmail_path at msmtp with -C naming your config and -t for recipients. PHP and cron then send through your SMTP accounts with no local mail server. The msmtp-mta package provides the /usr/sbin/sendmail symlink for this. Note the daemon mode cannot see per-user configs.
Notice an outdated path? Let us know.