[FIX] website: add the email of when a user fill the website form

Purpose
=======
When a public user fill a form on Website (e.g. /contactus), an email
will be sent. The email filled in the form will be used as the "email
from", but if no mail server match this email address it will be
encapsulated into "`notifications@mycompany.com`" (see odoo/odoo#61853).

Even though the email is still present in the "Reply-To" header, we
want to add it at the end of the email, so the receiver has this
information easily.

Task-2833093

closes odoo/odoo#94728

X-original-commit: a57944cc387a0b2f0eb6450a14a14e149c720181
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
std-odoo
2022-06-28 11:41:18 +02:00
parent 12121cc7b9
commit bfee828603
2 changed files with 15 additions and 0 deletions
+9
View File
@@ -173,6 +173,15 @@ class WebsiteForm(http.Controller):
except ValueError:
error_fields.append(field_name)
if dest_model._name == 'mail.mail' and field_name == 'email_from':
# As the "email_from" is used to populate the email_from of the
# sent mail.mail, it could be filtered out at sending time if no
# outgoing mail server "from_filter" match the sender email.
# To make sure the email contains that (important) information
# we also add it to the "custom message" that will be included
# in the body of the email sent.
custom_fields.append((_('email'), field_value))
# If it's a custom field
elif field_name != 'context':
custom_fields.append((field_name, field_value))
+6
View File
@@ -10597,6 +10597,12 @@ msgstr ""
msgid "eLearning"
msgstr ""
#. module: website
#: code:addons/website/controllers/form.py:0
#, python-format
msgid "email"
msgstr ""
#. module: website
#. openerp-web
#: code:addons/website/static/src/xml/website.xml:0