The issue is the fact that you are using the onEdit simple trigger. Simple triggers can only be used to modify the spreadsheet itself and not use any external services such as sending an email. You can change this to an installed trigger by changing the name of the function, defining the trigger manually and doing the required authorization approval. But note that any user of the spreadsheet will also need to do the authorization for the trigger to work for them.
Hope this helps.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/0ea2f2be-84c1-4756-a078-df7854f36309n%40googlegroups.com.