Retrieve Account's email address in a Gmail app - google-apps-script

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?

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.

Related

What are "single account SMTP plugins" in "Exceptions to verification requirements" of Google OAuth API verification?

Does anyone know what are the "single account SMTP plugins" referenced here in this Google OAuth API policy?
See the last bullet of the "Exceptions to verification requirements":
SMTP/IMAP/WP: The app is used to send emails through WordPress, or similar single-account SMTP plugins.
Answer
Single-account is one account connected to your project or the only sender in it and SMTP plugins refers to the plugin that uses this OAuth token in order to send messages.
In summary, the bullet SMTP/IMAP/WP means that if you are using WordPress and set it up to be able to send emails using Gmail scopes, this is relegated to a single account SMTP plugin use and is not applicable for verification. Otherwise if your app is meant for public use it might require using https://mail.google.com/ scope, you will need to submit your app for the restricted scope verification.

GMail API/Google Workspace Add-on to automatically process emails with my own API

I'm wondering if I can use the GMail API, or some Google Workspace Add-On to aautomatically handle emails received by a specific address.
I have my own web app API, and I'd like any email sent to a specific address to trigger an API call to my web app, without a user having to manually do anything. (I can only seem to find references to how to do this using a visual interface that a user must interact with)
Ideally, this would work for a group address, but an actual account works too if that's a limitation.
Cheers!

GmailApp for specific email or forced to use logged in email?

GmailApp.search is great for pulling emails but what if I want to access a specific Gmail account logged in or not logged in is this possible with GmailApp or maybe some other method I am unaware of? Or am I forced to use the email address the user is logged in?
Due to security and privacy concerns, GmailApp service as well as the rest of the services provided by Google Apps Script and Google REST APIs can only access the logged-in user's data. In order to access another user's data, he/she will have to manually log in using the oAuth2 flow. As an option, you may create a WebApp that the end-user would connect to and manually authorize your application to be run using his/her data.

Enabling send-only email addresses as collaborators?

We've shared a folder via email access. Would like to restrict receipt to a list of collaborators by email address. By default, Box.com requires that each collaborator respond to an invite email and create a Box.com account.
One of our collaborators will be a system sending with a send-only email address.
Is it possible to setup send-only email addresses as collaborators? Perhaps a way that we could "auto-accept" them?
Thanks.
Currently all email addresses must be confirmed Box accounts. A possible workaround is manually confirming the email addresses for these Box accounts.

Retrieve Email address of file owner permission?(apps domain)

I have the owner permission of a certain file. I wan't to share this file around in the domain. For this in need to impersonate the owner. To impersonate a user I use a service account, but I still need a ServiceAccountUser. The serviceAccountUser is the email adress of the owner.
I can read the owner name from the permission but I don't know how to get his email adress.
I got suggested to use the profile API to gather this information, but I was wondering if there isn't a way to do this with the drive api.
How can I retrieve the Email adress of the file owner permission?
You cannot do that with Drive API, until Google hopefully changes it.
You will have to use the old Document List API and its AclFeed to retrieve the emails of your users