Modify the signature for all users in my domain

ε祈祈猫儿з 提交于 2020-01-24 23:11:28

问题


Currently my code only modifies my signature, because when I put the email of the other person in my domain, the error: Not Found (line 9, file "Code") appears.

My current code:

function myFunction() {
  var newSignature = Gmail.newSendAs();
  newSignature.signature = "signature";

  var listEmails = [
    "leticia@domain.com"]

  var updateSignature = Gmail.Users.Settings.SendAs.update(newSignature, "me", listEmails)
}

I am developing using APPS SCRIPT.

Any suggestions for me to be able to change the signature of someone else in my domain?


回答1:


To change other people Gmail settings in your domain you'll need to be a domain Admin, then create a service account with domain-wide authority, then whitelist it in the Admin Console. Then use said service account and authentication token generated to authenticate your requests to the Gmail API.

This built-in Apps Script Gmail integration was not made for that use-case. The intended usage is to setup your own settings, or individual users that explicitly authorize your application to run on their behalf. This sendAs is there because one might have multiple Gmail signatures, depending on their selected send-as/from alias.

Note that simply authorizing an script with your GSuite admin account won't allow to the script to perform domain-wide operations. That'd be too dangerous, therefore the somewhat convoluted service-account setup is required.

Link to the relevant documentation



来源:https://stackoverflow.com/questions/52339032/modify-the-signature-for-all-users-in-my-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!