def send_get_mail_to(self, cr, uid, mail, partner=None, context=None): """Forge the email_to with the following heuristic: - if 'partner', recipient specific (Partner Name <email>) - else fallback on mail.email_to splitting """ if partner: email_to = [formataddr((partner.name, partner.email))] else: email_to = tools.email_split_and_format(mail.email_to) return email_to
def _track_sendgrid_emails(self): """ Create tracking e-mails after successfully sent with Sendgrid. """ self.ensure_one() m_tracking = self.env['mail.tracking.email'].sudo() track_vals = self._prepare_sendgrid_tracking() for recipient in tools.email_split_and_format(self.email_to): track_vals['recipient'] = recipient m_tracking.create(track_vals) for partner in self.recipient_ids: track_vals.update({ 'partner_id': partner.id, 'recipient': partner.email, }) m_tracking.create(track_vals)