gmail.js
gmail.js copied to clipboard
api.get.user_email does not work with non-workspace email addresses
As explained in this comment: https://github.com/KartikTalwar/gmail.js/issues/779#issuecomment-2000089915
It seems that the error occurs with personal accounts: @gmail.com, with professional accounts it works correctly.
To fix this error, add these instructions:
if(api.tracker.globals.length == 0 && GLOBALS !== "undefined" && GLOBALS.length > 11) api.tracker.globals = GLOBALS;
to the function: api.get.user_email
api.get.user_email = function() { if(api.tracker.globals.length == 0 && GLOBALS !== "undefined" && GLOBALS.length > 11) api.tracker.globals = GLOBALS; let user_email = api.tracker.globals[10]; if (user_email) { return user_email; } const elements = document.getElementsByClassName("eYSAde"); for (const el of elements) { if (el.innerHTML.indexOf("@") === -1) { return el.innerHTML; } } return null; };
Location: api.get.user_email
There is a simple fix explained in the comment that worked for me. Just wanted to make a separate issue to make sure this doesn't fall through the cracks 😉
Problem
The api.get.user_email
method always returns null
Testing Conditions
Problem can only be reproduced by using a gmail account ending in @gmail.com
.