diff --git a/frappe/email/inbox.py b/frappe/email/inbox.py index 76396b9e1b..f709f3f8d2 100644 --- a/frappe/email/inbox.py +++ b/frappe/email/inbox.py @@ -55,8 +55,12 @@ def create_email_flag_queue(names, action): for name in json.loads(names or []): uid, seen_status, email_account = frappe.db.get_value( - "Communication", name, ["ifnull(uid, -1)", "ifnull(seen, 0)", "email_account"] + "Communication", name, ["uid", "seen", "email_account"] ) + if not uid: + uid = -1 + if not seen_status: + seen_status = 0 # can not mark email SEEN or UNSEEN without uid if not uid or uid == -1: