msmtp-scripts

Homepage of the msmtp-scripts project.

Overview

These scripts are wrappers around the msmtp SMTP client that add additional functionality.

The primary purpose is to allow the use of msmtp as replacement for
sendmail with including queueing, and the option to require that emailbe confirmed after some delay before sending it out.

Most of the scripts are modified from the msmtpq script originally from the msmtp project.

Status Badges

Travis CI results Coverage Status Copr build status

Installation Instructions

Ubuntu

Add PPA for CI/per-push builds

sudo add-apt-repository ppa:cshoredaniel/msmtp-scripts-current-daily
sudo apt-get update

OR

Add PPA for stable builds

sudo add-apt-repository ppa:cshoredaniel/msmtp-scripts-stable
sudo apt-get update

Install system MTA

sudo apt install msmtp-scripts-mta

Optionally install localhost SMTPD

sudo apt install ms-mta-smtpd-systemd

or:

sudo apt install ms-mta-smtpd-xinetd

Debian

Add the following to /etc/apt/sources.list.d/msmtp-scripts.list

Add PPA for CI/per-push builds

deb http://ppa.launchpad.net/cshoredaniel/msmtp-scripts-current-daily/ubuntu xenial main
deb-src http://ppa.launchpad.net/cshoredaniel/msmtp-scripts-current-daily/ubuntu xenial main

OR

Add PPA for stable builds

deb http://ppa.launchpad.net/cshoredaniel/msmtp-scripts-stable/ubuntu xenial main
deb-src http://ppa.launchpad.net/cshoredaniel/msmtp-scripts-stable/ubuntu xenial main

Add signing key

and place the following in cshoredaniel.asc, and do sudo apt key add cshoredaniel.asc

-----BEGIN PGP PUBLIC KEY BLOCK-----

xsFNBFcE3jIBEADIDhbmR0f4TIdR24JAat1psD/gV89Ul7wOZ8joNTa+ZTrVaGKs
t0Dws6pg2UPW2SxF9G5Jgnwe+dyhL1WEjXcutfO7sKzpu4A7fk5M2DuCMHTN/Gxw
XToHBuzuUrnmY3UNXVg2rE/uaDHS7fjtSFYkZbmloFIYy7VQyAdadTwflrz6lJW4
K8U7UQymt/vrTs2gLDgtpyodqPsnnTCCJgkK4N+g7LCZoDFGv/izHTNPCy99ndFS
53En0H0wb/mhQr3I38RbwkE9iFJkxk4mVSSCLM9HN5HevcmJd7G/uf5tDrk7MGrf
gfjPxG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OuqAaMD6HlYekfrI+ATICh
5yOEzjOTElfOuaCSH6FKnYT8+nl7mO4SRAvy+tL7sWreotiWNRq9x7dUC+E3PNAT
gF6471JGiS3las984V8zCQlehtQXsk2ca6D8MEPNQ3os5FUv8oA=
=fGT0
-----END PGP PUBLIC KEY BLOCK-----

Add the system MTA

sudo apt update

sudo apt install msmtp-scripts-mta

Optionally add localhost SMTPD

sudo apt install ms-mta-smtpd-systemd

or:

sudo apt install ms-mta-smtpd-xinetd

CentOS 7

yum install yum-plugin-copr
yum copr enable cshoredaniel/msmtp-scripts-ci
yum swap postfix mstmtp-scripts-msmtpq-ng-mta

optionally:

yum install msmtp-scripts-ms-mta-smtpd-systemd

or:

yum install msmtp-scripts-ms-mta-smtpd-xinetd

NB: For stable series builds use yum copr enable cshoredaniel/msmtp-scripts
instead of yum copr enable cshoredaniel/msmtp-scripts-ci

If you also use logwatch and have SELinux enabled and enforcing, you need to yum install msmtp-scripts-logwatch-selinux

Fedora 30 & Rawhide

dnf copr enable cshoredaniel/msmtp-scripts
dnf swap postfix msmtp-sripts-msmtpq-ng-mta

optionally:

dnf install msmtp-scripts-ms-mta-smtpd-systemd

or:

dnf install msmtp-scripts-ms-mta-smtpd-xinetd

NB: For stable series builds use dnf copr enable cshoredaniel/msmtp-scripts
instead of dnf copr enable cshoredaniel/msmtp-scripts-ci

If you also use logwatch and have SELinux enabled and enforcing, you need to yum install msmtp-scripts-logwatch-selinux

Post-Install

You will will need to create a configuration files for msmtp (the
SMTP client that msmtp-scripts uses). For msmtpq-ng-mta (fedora/enterprise linux) / msmtp-scripts-mta (debian/ubuntu) the default location where you need to add the file is /etc/msmtpq-ng-mta-msmtprc

See man 1 msmtp for what needs to be included in the file.

Revived

I had deprecated this (see below) but for a couple of specific simple use cases it's still useful and a user request prompted me to unarchive it.

Use Cases

  • Embedded devices where a user does not have a full blown mail server on their local network and we don't want to lose mail due to lose of connectivity to the internet.
  • Specifically we're here for the use case when the mail is non-
    critical so if a major event (i.e. total power loss, resulting in
    loss of queue in RAM) happens it's not the end of the world, but
    you'd still prefer not to lose the mail to a temporary internet
    issue. In that case other solutions may be overkill or, like ssmtp,
    you'll lose mail if the outgoing mail server is unreachable at the
    time.
    • But: If mail loss is an issue, it would be better to have a way
      to host a turnkey mail server for local and vpn mail only, on the
      local network
  • Devices where space is a premium but where mail service is wanted

    • But: msmtp is really bigger than is ideal for this anyway
  • As a replacement for system mail queue on 'standard' distros

  • Doesn't have the problem of losing mail that embedded systems with queue in RAM do.
  • It is quite small and avoids having a bulky and complex mail system just to get system messages.

Additional Notes

  • Was initially created as a quick hack and although progress has
    been made on adding somewhat proper CI.
  • Tests are pretty ad-hoc at the moment
  • Written in POSIX shell and that is unlikely to change as the
    effort required to write in something like C is in far in excess of
    the need for the application.

WARNING: Tests modify your root filesystem

  • The tests are designed for throwaway containers such as Travis and
    therefore feel free to modify the root filesystem. You shouldn't
    run them on a production system.

Launchpad Project Information

Currently hosted as msmtp-scripts launchpad.net project. See 1.2 series targets for current milestones.

GitHub Repository

The code is currently hosted on GitHub in the cshoredaniel/msmtp-scripts repository.