in my company environment auto-forward vial gmail filter has been deactivated by admin for security reasons. However I am in the situation of having to forward multiple emails on a daily basis. So I thought I program a little addon that can help me.
The workflow should be:
- select multiple emails in the main window (manually)
- open widget / add-on in the sidebar
- enter email addresses to forward to
- press send
While I am able to create a widget in the sidebar via CardService. I struggle to "grab" the selected emailthreads in an array or List, so I can loop and forward.
My question: After pressing "send" I need to grab the selected mails via AppScript code, like
var selectedMail = [email1, email2, ...]
Could anyone please help me to kickstart this? Thanks!
CodePudding user response:
Answer:
It's currently not possible to access selected threads in Gmail add-on.
Feature request:
This feature has already been requested in Issue Tracker:
I'd suggest you to star the referenced issue in order to help prioritizing it and to keep track of it.
Workaround:
With current functionalities, I think your best option (as mentioned by Cooper) would be to:
- Retrieve all threads in your inbox (see getInboxThreads), either to a custom HTML (web apps, dialogs and sidebars) or to an add-on Card.
- Select your desired threads on that custom HTML/Card (using checkboxes, or what have you - see SelectionInput for cards).
- Once your desired threads are selected, call a function that will forward the corresponding messages, using GmailMessage.forward.
