Open imllc opened 6 years ago
Hello, @imllc not able to replicate this issue in the latest version. Can you please check and update if it still persists?
Hello, @imllc not able to replicate this issue in the latest version. Can you please check and update if it still persists?
@jaichavan I can confirm that it is not working in the latest version too. Below are the logs.
`Traceback (most recent call last):
File "/home/erpnext/frappe-bench/apps/frappe/frappe/app.py", line 61, in application
response = frappe.handler.handle()
File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 32, in handle
return build_response("json")
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/response.py", line 52, in build_response
return response_type_map[frappe.response.get('type') or response_type]()
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/response.py", line 86, in as_json
response.data = json.dumps(frappe.local.response, default=json_handler, separators=(',',':'))
File "/usr/lib/python3.5/json/__init__.py", line 237, in dumps
**kw).encode(obj)
File "/usr/lib/python3.5/json/encoder.py", line 198, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.5/json/encoder.py", line 256, in iterencode
return _iterencode(o, 0)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/response.py", line 147, in json_handler
(type(obj), repr(obj)))
TypeError: Object of type <class '_sre.SRE_Match'> with value of <_sre.SRE_Match object; span=(9, 13), match='1902'> is not JSON serializable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/erpnext/frappe-bench/env/lib/python3.5/site-packages/gunicorn/workers/sync.py", line 135, in handle
self.handle_request(listener, req, client, addr)
File "/home/erpnext/frappe-bench/env/lib/python3.5/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/home/erpnext/frappe-bench/env/lib/python3.5/site-packages/werkzeug/local.py", line 231, in application
return ClosingIterator(app(environ, start_response), self.cleanup)
File "/home/erpnext/frappe-bench/env/lib/python3.5/site-packages/werkzeug/wrappers/base_request.py", line 235, in application
resp = f(*args[:-2] + (request,))
File "/home/erpnext/frappe-bench/apps/frappe/frappe/app.py", line 87, in application
response = handle_exception(e)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/app.py", line 148, in handle_exception
response = frappe.utils.response.report_error(http_status_code)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/response.py", line 33, in report_error
response = build_response("json")
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/response.py", line 52, in build_response
return response_type_map[frappe.response.get('type') or response_type]()
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/response.py", line 86, in as_json
response.data = json.dumps(frappe.local.response, default=json_handler, separators=(',',':'))
File "/usr/lib/python3.5/json/__init__.py", line 237, in dumps
**kw).encode(obj)
File "/usr/lib/python3.5/json/encoder.py", line 198, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.5/json/encoder.py", line 256, in iterencode
return _iterencode(o, 0)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/response.py", line 147, in json_handler
(type(obj), repr(obj)))
TypeError: Object of type <class '_sre.SRE_Match'> with value of <_sre.SRE_Match object; span=(9, 13), match='1902'> is not JSON serializable
`
It did work but the behavior was exactly as described by @imllc . Now it has stopped working completely.
This is still an active issue on any ideas on when it will be resolved? I can confirm still an issue with v12.4.2
I can confirm this is still an issue with v12.9.2
This still occurs with ERPNext v14.16.0, Frappe Framework v14.25.2. I'm trying to use my OAuth token to access the shared addresses through IMAP, but it's picking up my personal emails instead.
Any updates on this?
I can confirm the problem still exists with ERPNEXT v14.45.3 and Frappe framework v14.53.2. I took a look at the code and found the issue in frappe framework: frappe/email/doctype/email_account/email_account.py In the function of get_incoming_server:
def get_incoming_server(self, in_receive=False, email_sync_rule="UNSEEN"):
"""Returns logged in POP3/IMAP connection object."""
if frappe.cache.get_value("workers:no-internet") == True:
return None
oauth_token = self.get_oauth_token()
args = frappe._dict(
{
"email_account_name": self.email_account_name,
"email_account": self.name,
"host": self.email_server,
"use_ssl": self.use_ssl,
"use_starttls": self.use_starttls,
"username": getattr(self, "login_id", None) or self.email_id,
"use_imap": self.use_imap,
"email_sync_rule": email_sync_rule,
"incoming_port": get_port(self),
"initial_sync_count": self.initial_sync_count or 100,
"use_oauth": self.auth_method == "OAuth",
"access_token": oauth_token.get_password("access_token") if oauth_token else None,
}
)
In the args, "username": getattr(self, "login_id", None) or self.email_id should be just username: self.email_id
It should not try to get the login_id as that will be the "personal account" we use to access the shared mailbox. It will then pick up from the personal mailbox instead of the shared mailbox.
For sending outgoing mail, it will be correct the use the personal mailbox to send as the shared mailbox in Microsoft 365 does have the capacity to send email. But it is not the case for incoming mail.
I hope Frappe engineer can rectify this in the code soon. So I don't need to create a PR :)
When specifying ERPNext to collect mail using this value Use Different Email Login ID mail is collected from login account not the shared mailbox as is referenced here:
https://discuss.erpnext.com/t/exchange-shared-mailboxes-authenticating-with-username/34949/2?u=imllc