Deploying the email templates
The templates of the email notifications sent by S-Filer Portal are grouped in notification themes and stored in the database. Deploying them means importing a directory of HTML files into the database with the S-Filer Config CLI.
Warning
Because the templates are stored in the database, they are shared by every server of the installation and they are preserved when S-Filer Portal is updated.
Preparing the files
Unpack my-theme-mail.zip in a working directory. The import-notification-themes command does not take a ZIP archive: it reads a directory tree.
The tree contains one directory per notification theme, each holding one subdirectory per language (de, en, es, fr, it), and each language directory holding the template files:
working-folder/
my-theme/
en/
framework.html
file_available_subject.html
file_available_body.html
...
fr/
de/
es/
it/Every notification has a subject file and a body file, and each language directory also contains framework.html, the layout in which every body is inserted.
Warning
The template files must be encoded in UTF-8. The command reports the files it cannot read and falls back to the default template for each one of them, so an encoding problem results in a partly deployed theme rather than a failure.
The command also reports the languages that are declared as supported in the configuration but missing from the directory, and the languages present on disk that are not supported by the configuration.
Importing the templates
Use the import-notification-themes command. The -p option points to the parent directory that holds the themes, and -th names the theme directory to import. Do not confuse it with the global -p option (the password), placed before the command name, which the examples leave out: the CLI then asks for the password.
./sfiler-config-cli.sh -l my-user -cf "conf/sfiler.conf" import-notification-themes -p /working-folder -th my-theme.\sfiler-config-cli.bat -l my-user -cf "conf\sfiler.conf" import-notification-themes -p \working-folder -th my-themeThe options that matter most for a deployment are:
| Option | Description |
|---|---|
--dry-run | Simulates the import and reports what would be done, without writing to the database. Run this first. |
--allow-update | Updates a theme that already exists in the database instead of returning an error. Required to redeploy a theme. |
-all | Imports every theme found under -p, instead of naming them with -th. |
-cl | Clones an existing theme of the database on import, so the new theme starts from it. |
-d | Makes the imported theme the default notification theme. |
Example
Validate the files first, then redeploy a theme that is already in the database:
./sfiler-config-cli.sh -l my-user -cf "conf/sfiler.conf" import-notification-themes -p /working-folder -th my-theme --dry-run
./sfiler-config-cli.sh -l my-user -cf "conf/sfiler.conf" import-notification-themes -p /working-folder -th my-theme --allow-updateModifying the templates after the import
Once the templates are imported, the database becomes the reference: the files of the working directory are no longer read, and editing them has no effect. Every later change is made directly in the administrative interface, which provides an HTML editor, a real-time preview, a Show in layout checkbox to see a template inside framework.html, and a Send a test email button.
To work on the templates outside of the interface (to put them under version control, for example), export them with the export-notification-theme command, edit the exported files, then import them again with --allow-update.
An exported theme is in a folder named after the theme id. Pass that folder name to -th: a folder name that is a number is matched to the theme with that id, otherwise to the theme with that name. You can therefore also rename the folder to the theme name.
