Skip to content

Latest system, installation of new system CRMv1.67.1 Assignment throws OutgoingEmailError if no default email account is configured #2066

@1060778506

Description

@1060778506

Description: When assigning a CRM Deal, the system triggers send_notification_email. If no outgoing email account is setup (which is common in new installations), the entire transaction fails with frappe.exceptions.OutgoingEmailError.

Suggestion: The system should use frappe.msgprint or simply queue the email without throwing a hard exception that breaks the UI flow.

Image Image


Traceback with variables (most recent call last):
  File "apps/frappe/frappe/desk/doctype/notification_log/notification_log.py", line 40, in after_insert
    send_notification_email(self)
      self = <NotificationLog: h45lr3cpvq>
  File "apps/frappe/frappe/desk/doctype/notification_log/notification_log.py", line 143, in send_notification_email
    frappe.sendmail(
      doc = <NotificationLog: h45lr3cpvq>
      get_url_to_form = <function get_url_to_form at 0x77bbd7ded3a0>
      strip_html = <function strip_html at 0x77bbd7deca40>
      user = {'email': 'sarah.demo@example.com', 'language': 'zh'}
      header = 'CRM-DEAL-2026-00007上的分配更新'
      email_subject = 'Administrator分派了新任务 CRM商机 Forge Digital 给你'
      args = {'body_content': '<strong>Administrator</strong>分派了新任务 <strong>CRM商机</strong> <b class="subject-title">Forge Digital</b> 给你', 'description': '<div>CRM Deal CRM-DEAL-2026-00007的分派</div>', 'document_type': 'CRM Deal', 'document_name': 'CRM-DEAL-2026-00007', 'doc_link': 'http://fjnb/app/crm-deal/CRM-DEAL-2026-00007'}
  File "apps/frappe/frappe/__init__.py", line 810, in sendmail
    return builder.process(send_now=now)
      recipients = 'sarah.demo@example.com'
      sender = ''
      subject = 'Administrator分派了新任务 CRM商机 Forge Digital 给你'
      message = '<p>\n\t<p class="text-color"><strong>Administrator</strong>分派了新任务 <strong>CRM商机</strong> <b class="subject-title">Forge Digital</b> 给你</p>\n</p>\n\n<blockquote>\n\t<div>CRM Deal CRM-DEAL-2026-00007的分派</div>\n</blockquote>\n\n<div class="more-info">\n\t<a href="http://fjnb/app/crm-deal/CRM-DEAL-2026-00007">Open Document</a>\n</div>'
      as_markdown = False
      delayed = True
      reference_doctype = None
      reference_name = None
      unsubscribe_method = None
      unsubscribe_params = None
      unsubscribe_message = None
      add_unsubscribe_link = 1
      attachments = None
      content = None
      doctype = None
      name = None
      reply_to = None
      queue_separately = False
      cc = []
      bcc = []
      message_id = None
      in_reply_to = None
      send_after = None
      expose_recipients = None
      send_priority = 1
      communication = None
      retry = 1
      now = False
      read_receipt = None
      is_notification = False
      inline_images = None
      template = 'new_notification'
      args = {'body_content': '<strong>Administrator</strong>分派了新任务 <strong>CRM商机</strong> <b class="subject-title">Forge Digital</b> 给你', 'description': '<div>CRM Deal CRM-DEAL-2026-00007的分派</div>', 'document_type': 'CRM Deal', 'document_name': 'CRM-DEAL-2026-00007', 'doc_link': 'http://fjnb/app/crm-deal/CRM-DEAL-2026-00007'}
      header = ['CRM-DEAL-2026-00007上的分配更新', 'orange']
      print_letterhead = False
      with_container = False
      email_read_tracker_url = None
      x_priority = 3
      email_headers = None
      text_content = None
      QueueBuilder = <class 'frappe.email.doctype.email_queue.email_queue.QueueBuilder'>
      builder = <frappe.email.doctype.email_queue.email_queue.QueueBuilder object at 0x77bbd3165350>
  File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 770, in process
    queue_data = self.as_dict(include_recipients=False)
      self = <frappe.email.doctype.email_queue.email_queue.QueueBuilder object at 0x77bbd3165350>
      send_now = False
      final_recipients = ['sarah.demo@example.com']
      queue_separately = False
  File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 821, in as_dict
    email_account = self.get_outgoing_email_account()
      self = <frappe.email.doctype.email_queue.email_queue.QueueBuilder object at 0x77bbd3165350>
      include_recipients = False
  File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 665, in get_outgoing_email_account
    self._email_account = EmailAccount.find_outgoing(
      self = <frappe.email.doctype.email_queue.email_queue.QueueBuilder object at 0x77bbd3165350>
  File "apps/frappe/frappe/email/doctype/email_account/email_account.py", line 42, in wrapper_cache_email_account
    matched_accounts = func(*args, **kwargs)
      args = (<class 'frappe.email.doctype.email_account.email_account.EmailAccount'>,)
      kwargs = {'match_by_doctype': None, 'match_by_email': '', '_raise_error': True}
      match_by = [None, '', True, 'default']
      matched_accounts = []
      cached_accounts = {}
      cache_name = 'outgoing_email_account'
      func = <function EmailAccount.find_outgoing at 0x77bbd32c4540>
  File "apps/frappe/frappe/email/doctype/email_account/email_account.py", line 407, in find_outgoing
    frappe.throw(
      cls = <class 'frappe.email.doctype.email_account.email_account.EmailAccount'>
      match_by_email = ''
      match_by_doctype = None
      _raise_error = True
      doc = False
  File "apps/frappe/frappe/__init__.py", line 615, in throw
    msgprint(
      msg = 'Please setup default outgoing Email Account from Tools > Email Account'
      exc = <class 'frappe.exceptions.OutgoingEmailError'>
      title = None
      is_minimizable = False
      wide = False
      as_list = False
      primary_action = None
  File "apps/frappe/frappe/__init__.py", line 580, in msgprint
    _raise_exception()
      msg = 'Please setup default outgoing Email Account from Tools > Email Account'
      title = None
      raise_exception = <class 'frappe.exceptions.OutgoingEmailError'>
      as_table = False
      as_list = False
      indicator = 'red'
      alert = False
      primary_action = None
      is_minimizable = False
      wide = False
      realtime = False
      sys = <module 'sys' (built-in)>
      _raise_exception = <function msgprint.<locals>._raise_exception at 0x77bbd1e8f600>
      inspect = <module 'inspect' from '/usr/local/lib/python3.11/inspect.py'>
      out = {'message': 'Please setup default outgoing Email Account from Tools > Email Account', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': 'e768edadd7a730bbafb1aeb2d46c18bcabb5ec6854241f4ea40f980e'}
  File "apps/frappe/frappe/__init__.py", line 531, in _raise_exception
    raise exc
      exc = OutgoingEmailError('Please setup default outgoing Email Account from Tools > Email Account')
      inspect = <module 'inspect' from '/usr/local/lib/python3.11/inspect.py'>
      msg = 'Please setup default outgoing Email Account from Tools > Email Account'
      out = {'message': 'Please setup default outgoing Email Account from Tools > Email Account', 'title': 'Message', 'indicator': 'red', 'raise_exception': 1, '__frappe_exc_id': 'e768edadd7a730bbafb1aeb2d46c18bcabb5ec6854241f4ea40f980e'}
      raise_exception = <class 'frappe.exceptions.OutgoingEmailError'>
frappe.exceptions.OutgoingEmailError: Please setup default outgoing Email Account from Tools > Email Account


        {"url": "https://github.com/frappe/erpnext", "branch": "v15.104.3"},
        {"url": "https://github.com/frappe/hrms", "branch": "v15.59.0"},
        {"url": "https://github.com/frappe/crm", "branch": "v1.67.1"},
        {"url": "https://github.com/frappe/insights", "branch": "v3.8.0"},
        {"url": "https://github.com/1060778506/fengjing_app.git", "branch": "develop"},
        {"url": "https://gitee.com/yuzelin/erpnext_china.git", "branch": "master"},
        {"url": "https://github.com/agritheory/beam", "branch": "v15.10.0"},
        {"url": "https://github.com/frappe/print_designer", "branch": "v1.6.7"},
        {"url": "https://github.com/frappe/builder", "branch": "v1.23.2"},
        {"url": "https://github.com/frappe/wiki", "branch": "master"},
        {"url": "https://github.com/agatho-daemon/crispy_print", "branch": "develop"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions