Skip to content
Ruthard Baudach edited this page Nov 21, 2013 · 10 revisions

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 and msmtpQ are two scripts supplied with the source code of msmtp that solve this problem. th q/Q stands for queue, they are bash scripts implementing a mail send queue.

After putting them on a directory on your path and making them executable (chmod +x), change the send line in your config.yaml to

  :sendmail: msmtpQ --account=account_name -t

and msmtpQ will queue the mail for you.

msmtpq is the send script, invoced as msmtpq -r to flush all mail. I'm using in in conjunction with incron and a short wrapper script: incrontab:

/home/me/.msmtp.queue IN_CLOSE_WRITE /path/to/msmtp_wrapper.sh $@/$#

and msmtp_wrapper.sh:

#!/bin/bash
# wrapper around msmtpq -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/msmtpq -r

See also

Clone this wiki locally