Custom message content
This page describes the template system used to format text messages sent
The template system used in Duplicati is quite simple, as it will essentially expand Windows-style environment placeholders, %EXAMPLE%
, into values. The same replace logic works for both the subject line (if applicable) and the message body.
Note: The description here only covers the text-based output (such as emails, etc). The template system for JSON is a bit different.
Duplicati has defaults for the body and subject line, but you can specify a custom string here. For convenience, the string can also be a path to a file on the machine, which contains the template.
An example custom template could look like:
The template engine supports reporting any setting by using the setting name as the template value. Besides the options, there are also a few variables that can be used to extract information more easily:
JSON output
If the output is JSON it needs to be handled different than regular text, to ensure the result is valid. The logic for this is to re-use the templating concept, but only as a lookup, to figure out what keys to include in the results.
An example template could be:
This will ensure that each of those values will be included in the extra
element in the JSON output. The default template for JSON output includes all fields listed above, but no options are included by default.
Last updated