Skip to content

Instantly share code, notes, and snippets.

@joshmckibbin
Last active May 6, 2025 19:03
Show Gist options
  • Save joshmckibbin/b3de1c4621e02c3294f355a22a667831 to your computer and use it in GitHub Desktop.
Save joshmckibbin/b3de1c4621e02c3294f355a22a667831 to your computer and use it in GitHub Desktop.
A bookmarklet for easily switching between different Outlook mailboxes.
javascript:(function() {
const emails = [
'[email protected]',
'[email protected]',
'[email protected]'
];
const baseUrl = 'https://outlook.office365.com/mail/';
if ( ! window.location.href.includes( baseUrl ) ) {
alert( 'This bookmarklet only works on Outlook email pages.' );
return;
}
var emailIndex = localStorage.getItem( 'outlookEmailIndex' );
if ( emailIndex === null ) {
emailIndex = 0;
for( const [i, email] of emails.entries() ) {
if ( window.location.href.includes(email) ) {
emailIndex = i;
break;
}
}
}
emailIndex++;
if ( emailIndex > emails.length - 1 ) {
emailIndex = 0;
}
localStorage.setItem( 'outlookEmailIndex', emailIndex );
window.open( baseUrl + emails[emailIndex], '_self' );
})();
@joshmckibbin
Copy link
Author

Usage

For Outlook on the Web

  1. Update the emails array with your own email addresses
  2. Copy and paste the entire block of code into the URL field of a browser bookmark
  3. Click to cycle through Outlook mailboxes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment