Explorar el Código

fix: email_string parsing when pulling email

version-14
Ahmad hace 3 años
padre
commit
6afa5c8da3
Se han modificado 1 ficheros con 4 adiciones y 5 borrados
  1. +4
    -5
      frappe/core/doctype/communication/communication.py

+ 4
- 5
frappe/core/doctype/communication/communication.py Ver fichero

@@ -12,7 +12,7 @@ from frappe.core.utils import get_parent_doc
from frappe.utils.bot import BotReply from frappe.utils.bot import BotReply
from frappe.utils import parse_addr, split_emails from frappe.utils import parse_addr, split_emails
from frappe.core.doctype.comment.comment import update_comment_in_doc from frappe.core.doctype.comment.comment import update_comment_in_doc
from email.utils import parseaddr
from email.utils import getaddresses
from urllib.parse import unquote from urllib.parse import unquote
from frappe.utils.user import is_system_user from frappe.utils.user import is_system_user
from frappe.contacts.doctype.contact.contact import get_contact_name from frappe.contacts.doctype.contact.contact import get_contact_name
@@ -372,10 +372,9 @@ def get_contacts(email_strings, auto_create_contact=False):


for email_string in email_strings: for email_string in email_strings:
if email_string: if email_string:
for email in email_string.split(","):
parsed_email = parseaddr(email)[1]
if parsed_email:
email_addrs.append(parsed_email)
result = getaddresses(email_string)
for email in result:
email_addrs.append(email[1])


contacts = [] contacts = []
for email in email_addrs: for email in email_addrs:


Cargando…
Cancelar
Guardar