From 8233ad2e6438d50584663d33cb2b635f26c3d68a Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Fri, 6 Jan 2023 13:44:10 +0100 Subject: [PATCH 1/2] [IMP] mail_environment: ssl certificate auth Add support to configure outgoing mail server to use SSL certificate authentication through mail environment. --- mail_environment/models/ir_mail_server.py | 8 ++++++++ mail_environment/readme/CONFIGURE.md | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/mail_environment/models/ir_mail_server.py b/mail_environment/models/ir_mail_server.py index 984cce41c..d4b6f2513 100644 --- a/mail_environment/models/ir_mail_server.py +++ b/mail_environment/models/ir_mail_server.py @@ -16,11 +16,19 @@ def _server_env_fields(self): "smtp_port": {}, "smtp_user": {}, "smtp_pass": {}, + "smtp_ssl_certificate": {}, # the value must be base64 encoded + "smtp_ssl_private_key": {}, # the value must be base64 encoded "smtp_encryption": {}, + "smtp_authentication": { + "compute_default": "_compute_default_authentication" + }, } mail_fields.update(base_fields) return mail_fields + def _compute_default_authentication(self): + return "login" + @api.model def _server_env_global_section_name(self): """Name of the global section in the configuration files diff --git a/mail_environment/readme/CONFIGURE.md b/mail_environment/readme/CONFIGURE.md index c7ef3c989..40ac6b851 100644 --- a/mail_environment/readme/CONFIGURE.md +++ b/mail_environment/readme/CONFIGURE.md @@ -38,3 +38,10 @@ Example of config file : You will need to create 2 records in the database, one outgoing mail server with the field name set to "odoo_smtp_server1" and one incoming mail server with the field name set to "odoo_pop_mail1". + +It is possible to use a SSL certificate for SMTP authentication. In this case, +you need to set the following entries in the configuration entry :: + + smtp_authentication = certificate + smtp_ssl_certificate = + smtp_ssl_private_key = From ea7216798f7dfa6463c026cd9fcd0782d1908c00 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Thu, 27 Jun 2024 15:20:44 +0200 Subject: [PATCH 2/2] [FIX] mail_environment: default computation fix the implementation of _compute_default_authentication to match what is expected by the mixin --- mail_environment/models/ir_mail_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mail_environment/models/ir_mail_server.py b/mail_environment/models/ir_mail_server.py index d4b6f2513..322fd51c9 100644 --- a/mail_environment/models/ir_mail_server.py +++ b/mail_environment/models/ir_mail_server.py @@ -27,7 +27,7 @@ def _server_env_fields(self): return mail_fields def _compute_default_authentication(self): - return "login" + self.update({"smtp_authentication": "login"}) @api.model def _server_env_global_section_name(self):