Search code examples
google-apps-scriptgmailgmail-addons

Retrieve Account's email address in a Gmail app


I'm writing a Gmail add-on and I need the email address of the user's account. How can I retrieve it using appsscript?


Solution

  • You can use the Session class:

    Session.getActiveUser()
    

    Note that there are some restrictions when the email address will be available, but for your use case - an add-on which likely receives express permission - this should not be an issue.