[IMP] various: support multi-emails in mailings
PURPOSE Be defensive when dealing with email fields, notably when having multi-emails or email field containing an already-formatted email. SPECIFICATIONS: MAIL COMPOSER IN MAILING When using the composer with a mailing, it currently skips recipients whose email is a multi-email due to the strict usage of 'email_normalize'. We can improve multi-email support by effectively checking for the first email found, using the "less strict" mode of normalize. It means more emails are detected as valid, and therefore sent. Due to lower support of multi-emails when sending emails, this even allows to send multiple emails as all emails are mailed. SPECIFICATIONS: DEFAULT RECIPIENTS Mailings are generally done using default recipients, aka using a model method that returns the people to mail: customers ('partner_id'), customer emails ('email_from'), specific implementation, ... This is implementation using '_message_get_default_recipients' that returns 'partner_ids', 'email_to' and 'email_cc' that are then used in the mail composer to generate final recipients. In this commit we better handle the content of email fields to avoid issues with multi-emails. For that purpose we correctly split the content of those fields. We now have several 'email_to' for records having multi-emails instead of a single badly-formatted 'email_to'. Task-2612945 (Mail: Defensive email formatting) Part-of: odoo/odoo#74474
Showing
- addons/crm/models/crm_lead.py 7 additions, 5 deletionsaddons/crm/models/crm_lead.py
- addons/event/models/event_registration.py 8 additions, 6 deletionsaddons/event/models/event_registration.py
- addons/mail/models/models.py 14 additions, 8 deletionsaddons/mail/models/models.py
- addons/mass_mailing/models/mailing_contact.py 7 additions, 6 deletionsaddons/mass_mailing/models/mailing_contact.py
- addons/mass_mailing/wizard/mail_compose_message.py 2 additions, 2 deletionsaddons/mass_mailing/wizard/mail_compose_message.py
- addons/test_mass_mailing/tests/test_mailing.py 11 additions, 18 deletionsaddons/test_mass_mailing/tests/test_mailing.py
Loading
Please register or sign in to comment