[FIX] google_gmail: remove the constraint on the from_filter

Bug
===
Remove the constraint on the from_filter for the Gmail outgoing mail
server, because it can be used for custom domain name, and we can allow
an email address to send as an other one.

E.G. if the user has an email address "admin@mycompany.com" and he
activated "all addresses from the domain", he would be able to set
- email: admin@mycompany.com
- from_filter: mycompany.com
to use the mail servers for all email addresses in the same domain.

Task-3169015
Ticket-3141747

closes odoo/odoo#113959

X-original-commit: e9426c8b7bd4eb3d5c2c1c89fcf6ee3bdef95b3b
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
std-odoo
2023-03-01 23:28:07 +01:00
parent e429addc1d
commit 5d15afdb30
@@ -64,11 +64,6 @@ class IrMailServer(models.Model):
'Incorrect Connection Security for Gmail mail server %r. '
'Please set it to "TLS (STARTTLS)".', server.name))
if server.from_filter != server.smtp_user:
raise UserError(_(
'This server %r can only be used for your personal email address. '
'Please fill the "from_filter" field with %r.', server.name, server.smtp_user))
def _smtp_login(self, connection, smtp_user, smtp_password):
if len(self) == 1 and self.smtp_authentication == 'gmail':
auth_string = self._generate_oauth2_string(smtp_user, self.google_gmail_refresh_token)