extsmail.confconfigure robust sending of e-mail to external commands


extsmail.conf is used to configure extsmail(1) and extsmaild(1). It consists of one or more key = value pairs. The following variables are defined:
Sets the location of the spool directory used by extsmail(1) and extsmaild(1). This is the only variable which must be set in every configuration file.
Specifies how often notifications of unsucessful deliveries should be made. If unspecified, or set to 0, notifications will never be made. Times are specified as a number followed by d (days), h (hours), m (minutes), or s (seconds).
The shell command to be executed when notify_failure_interval seconds / minutes / hours / days have elapsed since the last fully successful send cycle. If the string ${TIME} exists in the command, it is replaced with a pretty printed string detailing how much time has elapsed since the last fully successfuly send cycle. The resulting string is then passed to system(3). Note that no security checking is (or can be) done on the command, so this option should be used with caution if a single configuration file serves multiple users. Please check the warnings that come with system(3).
The shell command to be executed when 1 or more messages have been successfully sent. If the string ${SUCCESSES} exists in the command, it is replaced with a string representing the number of successfully sent messages. The same warnings that apply to notify_failure_cmd also apply to this command.


The extsmail configuration file is searched for, in order, in the following locations:
Per-user extsmail configuration.
System-wide extsmail configuration.


The simplest configuration file looks as follows:
spool_dir = "~/somewhere"
A more complex configuration which uses a notification framework to inform the user of mail sending and failure looks as follows:
spool_dir = "~/somewhere" 
notify_failure_interval = 30m 
notify_failure_cmd = "notify-send -a extsmaild -c email 
  -i mail-send -u critical 'extsmaild: ${TIME} since a fully 
  successful send cycle'" 
notify_success_cmd = "notify-send -a extsmaild -c email 
  -i mail-send -u low 'extsmaild: ${SUCCESSES} messages 
  successfully sent'"


extsmail(1), extsmail.externals(5), extsmaild(1)


Laurence Tratt ⟨http://tratt.net/laurie/⟩
November 2, 2008 OpenBSD 6.2