On https://mail.google.com/mail/u/0/#settings/accounts there is an option to Check email for other accounts. Normally Gmail checks those accounts for new mail every 60 minutes. With the 'Check mail now' button you can manually trigger this.
Does anyone know if this button can be triggered via a url / shortcut / api? I would like to create a button/script for myself to push when I want to check for new mail.
I solve it from this link: tutorial link
Now I have an Bookmarklet with a javascript command that does automatically the 4 clicks to reach the "Check Email Now".
Hope that it help you too.
This is the code in javascript:
(function () { const gmailWindow = window;
if(gmailWindow.location.href.indexOf("https://mail.google.com/") === -1){
alert('É preciso estar no Gmail para utilizar este recurso.');
return;
}
gmailWindow.location.assign('https://mail.google.com/mail/u/0/#settings/accounts');
const xpath = "//span[text()='Ver correio agora']";
const refreshAccounts = () => { const selectedNodeElements = gmailWindow.document.evaluate(xpath, gmailWindow.document, null, XPathResult.ANY_TYPE, null);
let currentNode = selectedNodeElements.iterateNext();
if (currentNode === null) {
setTimeout(refreshAccounts, 100);
} else {
while (currentNode) { currentNode.click(); currentNode = selectedNodeElements.iterateNext();
};
gmailWindow.location.assign('https://mail.google.com/mail/u/0/#inbox'); }; };
setTimeout(refreshAccounts, 100); })();