summaryrefslogtreecommitdiff
path: root/addons/mail
diff options
context:
space:
mode:
authorDharmraj Jhala <dja@odoo.com>2021-02-24 09:23:30 +0000
committerThibault Delavallée <tde@odoo.com>2021-04-23 13:09:10 +0000
commit15325b19c15a649041db75bacbe8409ae4c58df7 (patch)
tree56a719ce602ee20fbf1bad7715ad3e50fc7acf33 /addons/mail
parentae3209b56087bdf0b11927ab59f8b33541713876 (diff)
[FIX] {test_}mail: set bounced alias in bounce autoreply
Before this commit When someone tries to send a mail to a restricted alias (which can be anywhere in 'To', 'CC' or 'BCC') and if the sender is not allowed to do so, the mail bounces. However bounced mail shows info as if it bounced due to address provided in 'To', even though it is not always the case. Example you send a message to * 'To': 'valid@gmail.com' (okay) * 'Cc': 'myalias@odoo.com' (not allowed for you) Mail bounces because you are not allowed to send a mail to alias provided in 'Cc', but it shows the message that: `The following email sent to valid@gmail.com cannot be accepted because [...]`. After this commit Boucing alias is shown in message body. Above example becomes `The following email sent to myalias@odoo.com cannot be accepted [...].` Note: Because the alias can be present in `Bcc` too (which will not available in the message values we get in `message_route_verify` method), we simply use display name of the alias instead of finding mail address matching with alias from the message values. Task ID-2390310 closes odoo/odoo#69752 X-original-commit: 1b17d68a192585317165d64babb6f9753b61c972 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/mail')
-rw-r--r--addons/mail/models/mail_alias.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/mail/models/mail_alias.py b/addons/mail/models/mail_alias.py
index 9ae362d4349..28d4f1b0192 100644
--- a/addons/mail/models/mail_alias.py
+++ b/addons/mail/models/mail_alias.py
@@ -176,7 +176,7 @@ class Alias(models.Model):
def _get_alias_bounced_body_fallback(self, message_dict):
return _("""Hi,<br/>
The following email sent to %s cannot be accepted because this is a private email address.
-Only allowed people can contact us at this address.""", message_dict.get('to'))
+Only allowed people can contact us at this address.""", self.display_name)
def _get_alias_bounced_body(self, message_dict):
"""Get the body of the email return in case of bounced email.