I set up a service that I do not own that uses Gmail's SMTP server to send emails to several recipients when certain events happen in the service. The event categories that are sent by email are too broad and I'm only interested in a subset of those events. Therefore I'm sending a lot of emails that are not required.
Is there a way using Google Apps Script or something similar where I can intercept Gmail's SMTP server outgoing emails and drop some of those emails based on a criteria (e.g. message keywords) before sending them?