I am trying to find out if the following scenario is possible with apps script:
I can create the installable trigger based on the user action, but I struggle to see how I can retrieve the web user's email address who created the timed trigger (and who is executing it) at the moment when the email sending function is triggered.
Session.getActiveUser().getEmail() does not work in this case, unless the user has access to the apps script project hosting the email sending function?
Is there a workaround?
Edit:users would be all in the same domain
You are right that Session.getActiveUser().getEmail()
cannot always retrieve the user identity correctly from a WebApp
Use the People API (after enabling):
People.People.get("people/me", {personFields: "emailAddresses"}).emailAddresses[0].value