summaryrefslogtreecommitdiff
path: root/addons/mass_mailing/wizard/mail_compose_message.py
diff options
context:
space:
mode:
authorDavid Beguin <dbe@odoo.com>2018-08-08 15:50:40 +0200
committerDavid Beguin <dbe@odoo.com>2018-08-10 17:46:08 +0200
commit4b3766e8eb05fe4a9f1f083da6f4facf56b4f688 (patch)
tree2a5b49e04091d9af1be9989ffe30eb2db5ae6a56 /addons/mass_mailing/wizard/mail_compose_message.py
parenta1d6064dcc6d349c02556453e1aa052e60db41c0 (diff)
[IMP] mass_mailing : include invalid emails into ignored state
If the email is invalid (incorrect pattern), the mailing status is set to canceled and will be flaged as ignored in the mail.mail.statistics
Diffstat (limited to 'addons/mass_mailing/wizard/mail_compose_message.py')
-rw-r--r--addons/mass_mailing/wizard/mail_compose_message.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/mass_mailing/wizard/mail_compose_message.py b/addons/mass_mailing/wizard/mail_compose_message.py
index 737485978d8..782d7641190 100644
--- a/addons/mass_mailing/wizard/mail_compose_message.py
+++ b/addons/mass_mailing/wizard/mail_compose_message.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, tools
+from odoo.tools import email_re
class MailComposeMessage(models.TransientModel):
@@ -65,7 +66,8 @@ class MailComposeMessage(models.TransientModel):
else:
recips = tools.email_split(partners_email.get(res_id))
mail_to = recips[0].lower() if recips else False
- if (opt_out_list and mail_to in opt_out_list) or (seen_list and mail_to in seen_list):
+ if (opt_out_list and mail_to in opt_out_list) or (seen_list and mail_to in seen_list) \
+ or (not mail_to or not email_re.findall(mail_to)):
# prevent sending to blocked addresses that were included by mistake
mail_values['state'] = 'cancel'
elif seen_list is not None: