diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c044a..d403884 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [Version 1.0.2](https://github.com/dataiku/dss-plugin-sendmail/releases/tag/v1.0.2) - Feature release - 2024-05 + +- Features added + - Ability to specify a password to encrypt Excel files + ## [Version 1.0.1](https://github.com/dataiku/dss-plugin-sendmail/releases/tag/v1.0.1) - Feature release - 2024-04 - Recipe configurations saved in version 1.0.0 with "Attachments format" set to "Nothing selected" will no longer send CSV attachments. diff --git a/custom-recipes/send-mails-from-contacts-dataset/recipe.json b/custom-recipes/send-mails-from-contacts-dataset/recipe.json index 1e9d94e..91534aa 100644 --- a/custom-recipes/send-mails-from-contacts-dataset/recipe.json +++ b/custom-recipes/send-mails-from-contacts-dataset/recipe.json @@ -204,6 +204,14 @@ "description" : "File format for attachments" }, + { + "name": "encryption_password_excel", + "label" : "Encryption password", + "type": "PASSWORD", + "description" : "(Optional) Password to encrypt excel files, requires DSS 13.0 or above", + "visibilityCondition" : "model.attachment_type == 'excel_can_ac'" + }, + { "name": "sep_cond_format", "label": "Conditional formatting", diff --git a/custom-recipes/send-mails-from-contacts-dataset/recipe.py b/custom-recipes/send-mails-from-contacts-dataset/recipe.py index a2a4bad..eaceb9d 100644 --- a/custom-recipes/send-mails-from-contacts-dataset/recipe.py +++ b/custom-recipes/send-mails-from-contacts-dataset/recipe.py @@ -73,6 +73,7 @@ def does_channel_have_sender(channel_id): channel_has_sender = does_channel_have_sender(mail_channel) attachment_type = config.get('attachment_type', "send_no_attachments") +encryption_password_excel = config.get('encryption_password_excel', None) # Validation part 1 - Check some kind of value/column exists for body, subject, sender and recipient @@ -139,7 +140,7 @@ def does_channel_have_sender(channel_id): output_schema.append({'name': 'sendmail_error', 'type': 'string'}) output.write_schema(output_schema) -attachment_files = build_attachment_files(attachment_datasets, attachment_type, apply_coloring_excel) +attachment_files = build_attachment_files(attachment_datasets, attachment_type, apply_coloring_excel, encryption_password_excel) attachments_templating_dict = attachments_template_dict(attachment_datasets, project_key, apply_coloring_excel) diff --git a/plugin.json b/plugin.json index c02bd48..94825f8 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "id": "sendmail", - "version": "1.0.1", + "version": "1.0.2", "meta": { "label": "Send emails", "description": "Send emails based on a dataset containing a list of contacts, with optional attachments (other datasets)", diff --git a/python-lib/dku_attachment_handling.py b/python-lib/dku_attachment_handling.py index c1e8217..1fd892b 100644 --- a/python-lib/dku_attachment_handling.py +++ b/python-lib/dku_attachment_handling.py @@ -35,7 +35,7 @@ def attachments_template_dict(attachment_datasets, home_project_key, apply_color return attachments_dict -def build_attachment_files(attachment_datasets, attachment_type, apply_coloring_excel): +def build_attachment_files(attachment_datasets, attachment_type, apply_coloring_excel, encryption_password_excel): """ :param attachment_datasets: List of attachment datasets :param attachment_type: str, e.g. "excel", "csv" - "excel_can_ac" is treated as excel, "send_no_attachments" means none @@ -54,6 +54,10 @@ def build_attachment_files(attachment_datasets, attachment_type, apply_coloring_ request_fmt = "excel" if apply_coloring_excel and attachment_type == "excel_can_ac": format_params = {"applyColoring": True} + if encryption_password_excel: + if format_params is None: + format_params = {} + format_params["password"] = encryption_password_excel else: request_fmt = "tsv-excel-header"