|
@ -100,16 +100,20 @@ class MailTrackingEmail(models.Model): |
|
|
|
|
|
|
|
|
@api.model |
|
|
@api.model |
|
|
def email_is_bounced(self, email): |
|
|
def email_is_bounced(self, email): |
|
|
return len(self._email_score_tracking_filter([ |
|
|
|
|
|
('recipient_address', '=ilike', email), |
|
|
|
|
|
('state', 'in', ('error', 'rejected', 'spam', 'bounced')), |
|
|
|
|
|
])) > 0 |
|
|
|
|
|
|
|
|
if email: |
|
|
|
|
|
return len(self._email_score_tracking_filter([ |
|
|
|
|
|
('recipient_address', '=', email.lower()), |
|
|
|
|
|
('state', 'in', ('error', 'rejected', 'spam', 'bounced')), |
|
|
|
|
|
])) > 0 |
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
@api.model |
|
|
@api.model |
|
|
def email_score_from_email(self, email): |
|
|
def email_score_from_email(self, email): |
|
|
return self._email_score_tracking_filter([ |
|
|
|
|
|
('recipient_address', '=ilike', email) |
|
|
|
|
|
]).email_score() |
|
|
|
|
|
|
|
|
if email: |
|
|
|
|
|
return self._email_score_tracking_filter([ |
|
|
|
|
|
('recipient_address', '=', email.lower()) |
|
|
|
|
|
]).email_score() |
|
|
|
|
|
return 0. |
|
|
|
|
|
|
|
|
@api.model |
|
|
@api.model |
|
|
def _email_score_weights(self): |
|
|
def _email_score_weights(self): |
|
@ -148,11 +152,14 @@ class MailTrackingEmail(models.Model): |
|
|
@api.depends('recipient') |
|
|
@api.depends('recipient') |
|
|
def _compute_recipient_address(self): |
|
|
def _compute_recipient_address(self): |
|
|
for email in self: |
|
|
for email in self: |
|
|
matches = re.search(r'<(.*@.*)>', email.recipient) |
|
|
|
|
|
if matches: |
|
|
|
|
|
email.recipient_address = matches.group(1) |
|
|
|
|
|
|
|
|
if email.recipient: |
|
|
|
|
|
matches = re.search(r'<(.*@.*)>', email.recipient) |
|
|
|
|
|
if matches: |
|
|
|
|
|
email.recipient_address = matches.group(1).lower() |
|
|
|
|
|
else: |
|
|
|
|
|
email.recipient_address = email.recipient.lower() |
|
|
else: |
|
|
else: |
|
|
email.recipient_address = email.recipient |
|
|
|
|
|
|
|
|
email.recipient_address = False |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
@api.depends('name', 'recipient') |
|
|
@api.depends('name', 'recipient') |
|
|