I am trying to find out if the following scenario is possible with apps script:
- I deploy a web app that is executing according to the user accessing it.
- user opens the deployed web app and authorizes email sending
- user clicks on a button that triggers a google.script.run call to a function in Code.gs that createse a new, time based trigger to run at a predefined time,which will execute an email sending function also stored in Code.gs.
- At the predefined time, the email sending function sends an email in the name of the user that created this time based trigger.
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