How do I detect when I view an email in gmail with

2020-04-29 08:27发布

问题:

I'd like to trigger a script every time I view an email in gmail. Does anyone know if there a trigger for detecting this which i can bind to?

I'm open to doing this with any platform, not just google-apps-script.

回答1:

Short answer

At this time Google Apps Script doesn't have a triggers for Gmail events.

Explanation

On Google Apps Script there are three kinds of scripts, bounded, stand-alone and web apps, and two kinds of triggers, simple and installable

Scripts only could be bounded to documents, forms and spreadsheets.

The available simple triggers are:

  • onOpen(e)1,2,3
  • onEdit(e)2
  • onInstall(e)4
  • doGet(e)5
  • doPost(e)5

The available installable triggers are:

  • Time-driven triggers
  • Google Apps triggers
    • on open1,2,3
    • on edit2
    • on change2
    • on submit form2,3

Triggers by app

The triggers works on the following "environments":

  1. Google Documents editor
  2. Google Sheets editor
  3. Google Forms editor
  4. Add-ons
  5. Web Apps

Note: There are no simple nor installable that works on the Google Forms Viewer (response submission).

References

  • https://developers.google.com/apps-script/guides/standalone
  • https://developers.google.com/apps-script/guides/triggers/
  • https://developers.google.com/apps-script/guides/triggers/events