|
NAMEmsmtpd - A minimal SMTP serverSYNOPSISmsmtpd [option...]DESCRIPTIONMsmtpd is a minimal SMTP server that pipes mails to msmtp (or some other program) for delivery. It can be used with system services that expect an SMTP server on the local host, or it can be used by end users as a way to handle outgoing mail via msmtp with mail clients that insist on using SMTP. The EXAMPLES section below contains examples for both use cases.Msmtpd listens on 127.0.0.1 port 25 by default, but can also run without its own network sockets in inetd mode, where it handles a single SMTP session on standard input / output. In the string that defines the command that msmtpd pipes each mail to, the first occurrence of %F will be replaced with the envelope from address. Furthermore, all recipients of the mail will be appended as arguments. The command must not write to standard output, as that would mess up the SMTP session. If the command that the mail is piped to reports an error, this is typically reported as a permanent failure by msmtpd (SMTP server return code 554). The command can optionally signal temporary errors by using return codes defined in sysexits.h, e.g. 75 for EX_TEMPFAIL. These will then be reported as temporary failures by msmtpd (SMTP server return code 451), which means the client should try again later. To prevent abuse, msmtpd will allow only a limited number of concurrent SMTP sessions, and if authentication is active and an authentication failure occurrs, future authentication requests in any SMTP session will (for a limited duration) only be answered after a small delay. OPTIONS
EXAMPLESUsing msmtpd as a system serviceOnly use a local interface to listen on. Run msmtpd with correct user rights and permissions (e.g. use CAP_NET_BIND_SERVICE to bind to port 25 instead of running as root, or use systemd with inetd service capabilities). Be aware that the pipe command will be run as the same user that msmtpd runs as. Enable logging to syslog with --log=syslog. Example for managing msmtpd with start-stop-daemon: # start msmtpd start-stop-daemon --start --pidfile /var/run/msmtpd.pid --make-pidfile --chuid msmtpd --background --exec /usr/local/bin/msmtpd -- --command '/usr/local/bin/msmtp -f %F --' # stop msmtpd start-stop-daemon --stop --pidfile /var/run/msmtpd.pid --remove-pidfile --quiet --signal TERM Using msmtpd to handle outgoing mail for an SMTP-based mail client Some mail clients cannot send outgoing mail with a program like msmtp and instead insist on using an SMTP server. You can configure msmtpd to be that SMTP server and hand your outgoing mail over to msmtp. (Similarly, some mail clients cannot get incoming mail from a local mailbox and insist on using a POP3 or IMAP server. You can configure mpopd to be that POP3 server and serve incoming mail from a local mailbox. See the relevant section in the mpop manual.) For this purpose, msmtpd should listen on an unprivileged port, e.g. 2500. Furthermore, msmtpd should require authentication because otherwise anyone connecting to it can send mail using your account, even if it's just other users or processes on your local machine. Let's use the user name msmtpd-user for this purpose. You have two options to manage the password:
The complete command then is (using the keyring): msmtpd
--port=2500 --auth=msmtpd-user --command='/path/to/your/msmtp -f %F --'
SEE ALSOmsmtp(1)
Visit the GSP FreeBSD Man Page Interface. |