GmailApp
getAliases
is useful to get the list of aliases / imported accounts, it works.
But the returned list does not include the account's main email address.
How to get the account's main email address from GmailApp
? (without hardcoding it in a Google Apps script)
In this case, I would like to propose the following script.
const emailAddress = Session.getActiveUser().getEmail();
Reference: