Gaute Hope edited this page Sep 29, 2015 · 12 revisions
Clone this wiki locally

See an example with msmtp in a complete setup in Complete gmail configuration#Configuring-msmtp.


Using plain msmtp has one drawback: sup waits for msmtp to complete sending the mail before returning to work.

msmtpq is a set of bash scripts supplied with the source code of msmtp implementing a mail send queue.

They come in two flavours, the original msmtpqueue by Martin Lambers and msmtpq by Chris Gianniotis I am using here.

After putting msmtpq and msmtp-queue in a directory on your path and making them executable (chmod +x) change the sendmail lines in your config.yaml to

file: .sup/.config.yaml
  :sendmail: msmtpq --account=account_name -t

and msmtpq will queue the mail for you.

To flush the queue to your provider, invoke msmtp-queue -r by your favorite tools like cron, at, in your start scripts, .bashrc...

I'm using it with incron and a short wrapper script:

file: incrontab
/home/me/.msmtp.queue IN_CLOSE_WRITE /path/to/ $@/$#
# wrapper around msmtp-queue -r for use with incron.
# otherwise first call to msmtpq fails due to missing *.msmtp file,
# second call fails due to still existing lock file of first call

ls ${1%msmtp}mail 2>&1 > /dev/null && /home/ruthard/bin/msmtp-queue -r

See also