1MSMTPD(1)                   General Commands Manual                  MSMTPD(1)
2
3
4

NAME

6       msmtpd - A minimal SMTP server
7

SYNOPSIS

9       msmtpd [option...]
10

DESCRIPTION

12       Msmtpd  is  a  minimal  SMTP  server that pipes mails to msmtp (or some
13       other program) for delivery.  It can be used with system services  that
14       expect an SMTP server on the local host, or it can be used by end users
15       as a way to handle outgoing mail via msmtp with mail clients  that  in‐
16       sist  on  using SMTP.  The EXAMPLES section below contains examples for
17       both use cases.
18       Msmtpd listens on 127.0.0.1 port 25 by default, but can also run  with‐
19       out  its  own  network sockets in inetd mode, where it handles a single
20       SMTP session on standard input / output.
21       In the string that defines the command that msmtpd pipes each mail  to,
22       the  first occurrence of %F will be replaced with the envelope from ad‐
23       dress.  Furthermore, all recipients of the mail will be appended as ar‐
24       guments.  The  command must not write to standard output, as that would
25       mess up the SMTP session.
26       If the command that the mail is piped to reports an error, this is typ‐
27       ically  reported  as  a permanent failure by msmtpd (SMTP server return
28       code 554). The command can optionally signal temporary errors by  using
29       return codes defined in sysexits.h, e.g. 75 for EX_TEMPFAIL. These will
30       then be reported as temporary failures by msmtpd  (SMTP  server  return
31       code 451), which means the client should try again later.
32       To prevent abuse, msmtpd will allow only a limited number of concurrent
33       SMTP sessions, and if authentication is active  and  an  authentication
34       failure  occurrs,  future  authentication  requests in any SMTP session
35       will (for a limited duration) only be answered after a small delay.
36

OPTIONS

38       --version
39              Print version information
40
41       --help Print help
42
43       --inetd
44              Start single SMTP session on stdin/stdout
45
46       --interface=ip
47              Listen on the given IPv6 or IPv4 address instead of 127.0.0.1
48
49       --port=number
50              Listen on the given port number instead of 25
51
52       --log=none|syslog|filename
53              Set logging: none (default), syslog, or  logging  to  the  given
54              file.
55
56       --command=cmd
57              Pipe  mails to cmd instead of msmtp.  Make sure to end this com‐
58              mand with -- to separate options from arguments.
59
60       --auth=user[,passwordeval]
61              Require authentication with this user name. The password will be
62              retrieved  from  the given passwordeval command (this works just
63              like passwordeval in msmtp) or, if none is given, from  the  key
64              ring or, if that fails, from a prompt.
65

EXAMPLES

67       Using msmtpd as a system service
68       Only  use  a local interface to listen on. Run msmtpd with correct user
69       rights and permissions (e.g. use CAP_NET_BIND_SERVICE to bind  to  port
70       25  instead of running as root, or use systemd with inetd service capa‐
71       bilities). Be aware that the pipe command will be run as the same  user
72       that msmtpd runs as.  Enable logging to syslog with --log=syslog.
73       Example for managing msmtpd with start-stop-daemon:
74       # start msmtpd
75       start-stop-daemon  --start --pidfile /var/run/msmtpd.pid --make-pidfile
76       --chuid msmtpd --background --exec /usr/local/bin/msmtpd  --  --command
77       '/usr/local/bin/msmtp -f %F --'
78       # stop msmtpd
79       start-stop-daemon  --stop   --pidfile /var/run/msmtpd.pid --remove-pid‐
80       file --quiet --signal TERM
81       Using msmtpd to handle outgoing mail for an SMTP-based mail client
82       Some mail clients cannot send outgoing mail with a program  like  msmtp
83       and instead insist on using an SMTP server. You can configure msmtpd to
84       be that SMTP server and hand your outgoing mail over to msmtp.
85       (Similarly, some mail clients cannot get incoming  mail  from  a  local
86       mailbox  and  insist  on using a POP3 or IMAP server. You can configure
87       mpopd to be that POP3 server and serve incoming mail from a local mail‐
88       box. See the relevant section in the mpop manual.)
89       For  this  purpose,  msmtpd should listen on an unprivileged port, e.g.
90       2500.  Furthermore, msmtpd should require authentication because other‐
91       wise  anyone connecting to it can send mail using your account, even if
92       it's just other users or processes on your local machine.
93       Let's use the user name msmtpd-user for this purpose. You have two  op‐
94       tions to manage the password:
95
96              Store the password in your key ring, e.g. with secret-tool store
97              --label=msmtpd host localhost service smtp user msmtpd-user.  In
98              this case, use the msmtpd option --auth=msmtpd-user.
99
100              Store the password in an encrypted file and use the passwordeval
101              mechanism. Example for gpg: msmtpd  ...  --auth=msmtpd-user,'gpg
102              -q -d ~/.msmtpd-password.gpg'
103
104       The  complete  command  then is (using the keyring): msmtpd --port=2500
105       --auth=msmtpd-user --command='/path/to/your/msmtp -f %F --'
106       The mail client software must then be configured to  use  localhost  at
107       port  2500  for  outgoing mail via SMTP, and to use authentication with
108       user msmtpd-user and the password you chose. The mail client will prob‐
109       ably  complain  that  the SMTP server does not support TLS, but in this
110       special case that is ok  since  all  communication  between  your  mail
111       client and msmtpd will stay on the local machine.
112       This  setup also works with multiple mail accounts. Msmtp will pick the
113       correct one based on the envelope-from address given to it via  -f  %F.
114       You  do  not  need  multiple  instances of msmtpd for this purpose, and
115       therefore you need only one SMTP server in your mail client  configura‐
116       tion.
117

SEE ALSO

119       msmtp(1)
120
121
122
123                                    2021-09                          MSMTPD(1)
Impressum