diff --git a/mail_outbound_static/README.rst b/mail_outbound_static/README.rst index e5287cf6a0..ad7711172d 100644 --- a/mail_outbound_static/README.rst +++ b/mail_outbound_static/README.rst @@ -53,6 +53,9 @@ being appended into the proper Sender header instead. To accomplish this we: smtp_from and smtp_whitelist_domain values will be used if there is not mail server configured in the system. +* If your server doesn't support catchall too, you can activate `Reply To The Same Address` + flag, so 'Reply-To' in your message will be the same as 'From'. + **Table of contents** .. contents:: @@ -64,6 +67,7 @@ Usage * Navigate to an Outbound Email Server * Set the `Email From` option to an email address * Set the `Domain Whitelist` option with the domain whitelist +* Set the `Reply to the same address` option to modify 'Reply-To' message field Bug Tracker =========== @@ -81,6 +85,7 @@ Credits Authors ~~~~~~~ +* Solvti sp. z o.o. * brain-tec AG * LasLabs * Adhoc SA @@ -97,6 +102,7 @@ Contributors * `Quartile `__: * Yoshi Tashiro +* Sergei Ruzki Maintainers ~~~~~~~~~~~ diff --git a/mail_outbound_static/__manifest__.py b/mail_outbound_static/__manifest__.py index 5f7bbc7b3c..4db7ab0545 100644 --- a/mail_outbound_static/__manifest__.py +++ b/mail_outbound_static/__manifest__.py @@ -7,7 +7,10 @@ "version": "16.0.1.0.2", "category": "Discuss", "website": "https://github.com/OCA/social", - "author": "brain-tec AG, LasLabs, Adhoc SA, Odoo Community Association (OCA)", + "author": "Solvti sp. z o.o., " + "brain-tec AG, " + "LasLabs, Adhoc SA, " + "Odoo Community Association (OCA)", "license": "LGPL-3", "application": False, "installable": True, diff --git a/mail_outbound_static/i18n/mail_outbound_static.pot b/mail_outbound_static/i18n/mail_outbound_static.pot index da46df8422..f97ecd2b47 100644 --- a/mail_outbound_static/i18n/mail_outbound_static.pot +++ b/mail_outbound_static/i18n/mail_outbound_static.pot @@ -53,6 +53,18 @@ msgstr "" msgid "Not a valid Email From" msgstr "" +#. module: mail_outbound_static +#: model:ir.model.fields,field_description:mail_outbound_static.field_ir_mail_server__reply_to_the_same_address +msgid "Reply To The Same Address" +msgstr "" + +#. module: mail_outbound_static +#: model:ir.model.fields,help:mail_outbound_static.field_ir_mail_server__reply_to_the_same_address +msgid "" +"If you have no catchall support for this server and will activate " +"this option, Reply-To address will be the same as From address." +msgstr "" + #. module: mail_outbound_static #: model:ir.model.fields,help:mail_outbound_static.field_ir_mail_server__smtp_from msgid "" diff --git a/mail_outbound_static/models/ir_mail_server.py b/mail_outbound_static/models/ir_mail_server.py index 04559e120f..6512bc66ab 100644 --- a/mail_outbound_static/models/ir_mail_server.py +++ b/mail_outbound_static/models/ir_mail_server.py @@ -26,6 +26,11 @@ class IrMailServer(models.Model): " match with the domain whitelist." ) + reply_to_the_same_address = fields.Boolean( + help="If you have no catchall support for this server and will activate " + "this option, Reply-To address will be the same as From address." + ) + @api.constrains("domain_whitelist") def check_valid_domain_whitelist(self): if self.domain_whitelist: @@ -93,6 +98,13 @@ def _prepare_email_message(self, message, smtp_session): message.replace_header("Return-Path", email_from) else: message.add_header("Return-Path", email_from) + # If reply to the same address is True, + # Reply-To header field should have the same as sender address + if mail_server.reply_to_the_same_address: + message.replace_header("Reply-To", email_from) if message.get( + "Reply-To" + ) else message.add_header("Reply-To", email_from) + return smtp_from, smtp_to_list, message @api.model diff --git a/mail_outbound_static/readme/CONTRIBUTORS.rst b/mail_outbound_static/readme/CONTRIBUTORS.rst index 96f9e78569..93e743608c 100644 --- a/mail_outbound_static/readme/CONTRIBUTORS.rst +++ b/mail_outbound_static/readme/CONTRIBUTORS.rst @@ -7,3 +7,4 @@ * `Quartile `__: * Yoshi Tashiro +* Sergei Ruzki diff --git a/mail_outbound_static/readme/DESCRIPTION.rst b/mail_outbound_static/readme/DESCRIPTION.rst index b4ffa0ac61..daedfae9ca 100644 --- a/mail_outbound_static/readme/DESCRIPTION.rst +++ b/mail_outbound_static/readme/DESCRIPTION.rst @@ -22,3 +22,6 @@ being appended into the proper Sender header instead. To accomplish this we: * Add compatibility to define the smtp information in Odoo config file. Both smtp_from and smtp_whitelist_domain values will be used if there is not mail server configured in the system. + +* If your server doesn't support catchall too, you can activate `Reply To The Same Address` + flag, so 'Reply-To' in your message will be the same as 'From'. diff --git a/mail_outbound_static/readme/USAGE.rst b/mail_outbound_static/readme/USAGE.rst index 195f5a9396..346098b231 100644 --- a/mail_outbound_static/readme/USAGE.rst +++ b/mail_outbound_static/readme/USAGE.rst @@ -1,3 +1,4 @@ * Navigate to an Outbound Email Server * Set the `Email From` option to an email address * Set the `Domain Whitelist` option with the domain whitelist +* Set the `Reply to the same address` option to modify 'Reply-To' message field diff --git a/mail_outbound_static/static/description/index.html b/mail_outbound_static/static/description/index.html index 3ce778c7c2..bf7416a06e 100644 --- a/mail_outbound_static/static/description/index.html +++ b/mail_outbound_static/static/description/index.html @@ -1,4 +1,3 @@ - @@ -392,6 +391,8 @@

Mail Outbound Static

  • Add compatibility to define the smtp information in Odoo config file. Both smtp_from and smtp_whitelist_domain values will be used if there is not mail server configured in the system.
  • +
  • If your server doesn’t support catchall too, you can activate Reply To The Same Address +flag, so ‘Reply-To’ in your message will be the same as ‘From’.
  • Table of contents

    @@ -412,6 +413,7 @@

    Usage

  • Navigate to an Outbound Email Server
  • Set the Email From option to an email address
  • Set the Domain Whitelist option with the domain whitelist
  • +
  • Set the Reply to the same address option to modify ‘Reply-To’ message field
  • @@ -427,6 +429,7 @@

    Credits

    Authors

      +
    • Solvti sp. z o.o.
    • brain-tec AG
    • LasLabs
    • Adhoc SA
    • @@ -445,6 +448,7 @@

      Contributors

    • Yoshi Tashiro
    +
  • Sergei Ruzki <sergei.ruzki@gmail.com>
  • diff --git a/mail_outbound_static/tests/test_ir_mail_server.py b/mail_outbound_static/tests/test_ir_mail_server.py index c5f05b0d5d..ed8e7be5af 100644 --- a/mail_outbound_static/tests/test_ir_mail_server.py +++ b/mail_outbound_static/tests/test_ir_mail_server.py @@ -367,3 +367,24 @@ def test_10_not_valid_smtp_from(self): mail_server.smtp_from = "." mail_server.smtp_from = "notifications@test.com" + + def test_11_from_outgoing_server_with_catchall(self): + self._init_mail_server_domain_whilelist_based() + domain = "example.com" + email_from = "test@%s" % domain + + self.message.replace_header("From", email_from) + reply_to_address = self.message["Reply-To"] + message = self._send_mail(self.message) + self.assertEqual(message["Reply-To"], reply_to_address) + + def test_12_from_outgoing_server_no_catchall(self): + self._init_mail_server_domain_whilelist_based() + domain = "example.com" + email_from = "test@%s" % domain + expected_mail_server = self.mail_server_domainone + + self.message.replace_header("From", email_from) + expected_mail_server.reply_to_the_same_address = True + message = self._send_mail(self.message) + self.assertEqual(message["Reply-To"], expected_mail_server.smtp_from) diff --git a/mail_outbound_static/views/ir_mail_server_view.xml b/mail_outbound_static/views/ir_mail_server_view.xml index 5b533e96b4..fc158e20fa 100644 --- a/mail_outbound_static/views/ir_mail_server_view.xml +++ b/mail_outbound_static/views/ir_mail_server_view.xml @@ -13,6 +13,10 @@ +