'Convert a list of emails into a list partner_ids and a list
new_partner_ids. The return value is non conventional because
it is meant to be used by the mail widget.
:return dict: partner_ids and new_partner_ids'

@api.multi
def message_partner_info_from_emails(self, emails, link_mail=False):

    self.ensure_one()
    MailMessage = self.env['mail.message'].sudo()
    partner_ids = self._find_partner_from_emails(emails)
    result = list()
    for idx in range(len(emails)):
        email_address = emails[idx]
        partner_id = partner_ids[idx]
        partner_info = {'full_name': email_address, 'partner_id': partner_id}
        result.append(partner_info)
        if (link_mail and partner_info['partner_id']):
            email_address = email_address.replace('\\', '\\\\').replace('%', '\\%').replace('_', '\\_')
            email_brackets = ('<%s>' % email_address)
            MailMessage.search(['|', ('email_from', '=ilike', email_address), ('email_from', 'ilike', email_brackets), ('author_id', '=', False)]).write({'author_id': partner_info['partner_id']})
    return result
