Home > database >  MailApp automated emails don't include user's email signature
MailApp automated emails don't include user's email signature

Time:09-21

So I've created a few spreadsheets that are used by myself and several co-workers to send automated emails. However, I'm noticing that none of these emails include the users' email signature.

I'm having a hard time finding any info on this, the only thread I found references the GmailApp, but on Sending email from Google Sheets it says to use MailApp and not GmailApp so for all my scripts I've been using MailApp.

Would anyone be able to point me in the right direction?

CodePudding user response:

In order to automatically read a Gmail signature, you must use the Advanced Gmail Service or the Gmail API through Url Fetch Service. I think that the easier way to proceed is that you use the default OAuth scopes, usually the most permissive, then when you finish to use your script unauthorize it. You can do this automatically by adding ScriptApp.invalidateAuth(); at the end of your script. Note: I haven't used this method yet. If you decide to use it, verify that the authorization was removed.


The accepted answer from the referred Q/A uses the Advanced Gmail Service, not GmailApp. Anyway, instead of using the default OAuth scope that gives "complete" access to your script to your Gmail mailbox you might use one more specific. The options are listed here -> https://developers.google.com/gmail/api/reference/rest/v1/users.settings.sendAs/get. The more restrictive scope is https://www.googleapis.com/auth/gmail.readonly.

The complete list of the OAuth scopes for Gmail API -> https://developers.google.com/gmail/api/auth/scopes

  • Related