diff --git a/frappe/email/oauth.py b/frappe/email/oauth.py index 497ee65d45..b87839466f 100644 --- a/frappe/email/oauth.py +++ b/frappe/email/oauth.py @@ -65,7 +65,16 @@ class Oauth: ) if not res.startswith(b"+OK"): - raise + frappe.log_error( + title="POP3 OAuth Authentication Failed", + message=f"Response: {res}", + reference_doctype="Email Account", + reference_name=self.email_account, + ) + frappe.throw( + frappe._("POP3 OAuth authentication failed for Email Account {0}").format(self.email_account), + frappe.AuthenticationError, + ) def _connect_imap(self) -> None: self._conn.authenticate(self._mechanism, lambda x: self._auth_string)