frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.18k stars 7.24k forks source link

Process Statement of Account fails when sender is set #40247

Closed borgmatthew closed 7 months ago

borgmatthew commented 7 months ago

Information about bug

When a "sender" is set for a Process Statement of Account doc, the emails are not sent and an exception is thrown. This is happening because the sender field is of type Link, but here the value of the field is used as an email address.

The exception is attached (email redacted). The sender field can be configured when the Enable Auto Email is set.

Module

accounts

Version

Frappe version: v15.16.1 Erpnext version: v15.15.0

Installation method

docker

Relevant log output / Stack trace / Full Error Message.

Invalid email address Sender: Matthew Borg Seychell, Recipients: ***@gmail.com, 
Traceback: Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 745, in as_dict
    mail_to_string = cstr(mail.as_string())
                          ^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/email_body.py", line 338, in as_string
    self.validate()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/email_body.py", line 262, in validate
    validate_email_address(strip(self.sender), True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/__init__.py", line 196, in validate_email_address
    email = _check(e.strip())
            ^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/__init__.py", line 186, in _check
    frappe.throw(
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 593, in throw
    msgprint(
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 565, in msgprint
    _raise_exception()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 516, in _raise_exception
    raise exc
frappe.exceptions.InvalidEmailAddressError: Matthew Borg Seychell is not a valid Email Address
precihole commented 7 months ago

@borgmatthew can you share screenshot?

borgmatthew commented 7 months ago

This is the error message shown: image

Do you require any additional information?

precihole commented 7 months ago

Yes, that is a bug originating from Frappe's end.