Skip to content

lenormf/sendmail-tryqueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sendmail-tryqueue

sendmail-tryqueue is a script that tries sending an email by reading it on the standard input and forwarding it to the standard input of a given sendmail command. If the command fails, the email and command are stored on disk, in a "queue directory".

Emails stored in such manner can subsequently be re-sent by the script, which makes it a good addition to a MUA’s configuration.

Dependencies

  • Python3

Usage

Similarly to a sendmail command, sendmail-tryqueue reads an email on its standard input, and forwards it to the standard input of the sendmail command it’s passed as argument.

But it’s not intended to be a drop-in replacement with an additional side-effect, so it doesn’t implement any of the flags generally implemented from the sendmail API.

Example:

# Try to send an email
$ cat test.eml | sendmail-tryqueue send sendmail -- e@ma.il
# List the emails that could not be sent, and were consequently queued
$ sendmail-tryqueue list
# Try to re-send the emails in the queue,
# in the same order they were originally sent
$ sendmail-tryqueue flush

Queues are stored in ${XDG_DATA_HOME}/sendmail-tryqueue/queues by default.

The emails are written as .eml files, and sendmail commands as .sh scripts. Their name starts with a millisecond-based timestamp, contains the subject of the email, and is seeded with a random number in case the same email was being sent at the exact same time.

A generic database was purposefully not chosen to handle storing and reading the queues to allow interacting with the data stored more easily (e.g. with UNIX tools).

About

A generic utility that caches/queues emails that couldn't be sent

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published