r/GoogleAppsScript • u/wioneo • May 14 '22
Question Trigger a Script on Email Receipt
Is it possible to trigger a script anytime an email is received to a specific address? My plan was to have certain emails that will need to be regularly processed forwarded to "[email protected]." In gmail, I made a filter to apply a label and star those emails (using the star to tell if it's been processed yet).
I was hoping to find a way to base a trigger on a gmail label or just any email receipt if needed. This is to avoid running a script and scanning the label every minute.
This page mentions...
An installable calendar event trigger runs when a user's calendar events are updated—created, edited, or deleted.
If there's no way to trigger based on emails directly, could calendar events be a workaround. That would require figuring out how to reliably create calendar events from emails, which is an additional question.
EDIT: In case anyone finds this, I was able to activate a Google Apps Script based on a specific received email trigger by publishing the script as a web app, using a webhook call triggered by certain emails with a free Zohomail account, have emails labeled as noted above in Gmail and forwarded to the Zohomail account.
If you just need the email as a trigger and don't actually need the email contents for any processing, then you could just skip the forwarding part and send the email to Zoho directly.
1
u/RemcoE33 May 14 '22
Why is checking every minute not desirable?