2016-07-08 4 views
2

많은 타사 도구가 포함 된 EMail Settings API를 테스트 한 결과 인라인 된 포함 이미지 (Base64)는 제거 된 것으로 보이지만 WebGUI는 일부 브라우저에서 서명 된 인라인 포함 이미지를 만들 수 있습니다.새 GMail API 서명 설정

GMAIL API 서명이 개선 되었습니까? 새로운 API가 인라인 된 임베디드 이미지를 수락합니까 (아니면 계속 제거합니까?)?

+0

당신이 [이메일 설정 API (HTTPS 대해 이야기 : //developers.google.com/admin-sdk/email-settings/#manage_signature_settings) 서명 관리 [https://support.google.com/a/answer/175190]에 대한 문서를 확인하세요. ? hl = en). –

+0

아니요 방금 출시 된 새로운 Gmail API 변경 사항에 대해 말씀 드리고자합니다. 설명서는이 질문에 대답하지 않습니다. "html이 무엇이며 허락되지 않는지를 표시하지 않고"Google이 서명을 위생 처리합니다 "라고되어 있습니다. – Dom

답변

0

Gmail은 서명을위한 인라인 이미지 임베딩을 지원하지 않으며 이미지 연결 만 지원합니다.

일반적으로 API는 UI가 제공하는 것 이상의 기능을 제공하지 않습니다.

+0

아 잘못된 예입니다. 이미 인라인 된 임베디드 이미지를 Outlook에서 Google 메일 서명란의 Chrome으로 복사하여 붙여 넣어 이미지를 인라인으로 삽입 할 수 있습니다. 회사 전체에 인라인 이미지가 내장되어 있으므로 각 사용자가 아닌 수동으로 API를 사용할 수 있기를 바랍니다. – Dom

0

인라인 이미지 삽입에 대한 질문에 정확히 답할지는 모르겠지만 새 Gmail API를 사용하여 HTML을 통해 이미지에 이미지를 삽입 할 수있었습니다. 이전 답변에서 언급 한 Brandon Jewett-Hall이 링크 된 이미지이므로이 이미지를 서버에 호스팅해야합니다. 그러나 Gmail 계정을 사용하면 무료로 Google 사이트 도구에서 이미지를 호스팅 할 수 있습니다. 이러한 이미지가 포함 된 페이지를 웹에서 공개적으로 볼 수 있습니다. G Suite Basic 또는 Business가있는 경우 Google Apps Script를 사용하여 도메인의 모든 사용자의 서명을 변경할 수 있습니다. 이 게시물을 참조하십시오. How to use the Gmail API, OAuth2 for Apps Script, and Domain-Wide Delegation to set email signatures for users in a G Suite domain

<img src> 태그에 위키 백과에서 호스팅되는 공개 이미지를 사용하는 HTML을 통해 이미지를 삽입 할 때 도움이 될 수도 있습니다.

OAuth2 For Apps Script 라이브러리 프로젝트에 추가되어 있는지 확인합니다 :

function gmailSignatureImage() { 

    var email = '[email protected]' 

    var service = getDomWideDelegationService('Gmail: ', 'https://www.googleapis.com/auth/gmail.settings.basic', email); 

    var resource = { signature: '<div><strong>My signature image</strong></div>' + 
      '<div><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/251px-Google_2015_logo.svg.png" '+ 
      'alt="" border="0" /></div>' }; 

    var requestBody    = {}; 
    requestBody.headers   = {'Authorization': 'Bearer ' + service.getAccessToken()}; 
    requestBody.method    = "PUT"; 
    requestBody.contentType  = "application/json"; 
    requestBody.payload   = JSON.stringify(resource); 
    requestBody.muteHttpExceptions = false; 

    var emailForUrl = encodeURIComponent(email); 
    var url = 'https://www.googleapis.com/gmail/v1/users/me/settings/sendAs/' + emailForUrl; 
    var setSignatureResponse = UrlFetchApp.fetch(url, requestBody); 
} 


// these two things are included in the .JSON file that you download when creating the service account and service account key 
    var OAUTH2_SERVICE_ACCOUNT_PRIVATE_KEY = '-----BEGIN PRIVATE KEY-----\nxxxxxxxxxxxxxxxxxxxxx\n-----END PRIVATE KEY-----\n'; 
    var OAUTH2_SERVICE_ACCOUNT_CLIENT_EMAIL = 'xxxxxxxxxxxxxxxxxxxxx.iam.gserviceaccount.com'; 


function getDomWideDelegationService(serviceName, scope, email) { 

    Logger.log('starting getDomainWideDelegationService for email: ' + email); 

    return OAuth2.createService(serviceName + email) 
    // Set the endpoint URL. 
    .setTokenUrl('https://accounts.google.com/o/oauth2/token') 

    // Set the private key and issuer. 
    .setPrivateKey(OAUTH2_SERVICE_ACCOUNT_PRIVATE_KEY) 
    .setIssuer(OAUTH2_SERVICE_ACCOUNT_CLIENT_EMAIL) 

    // Set the name of the user to impersonate. This will only work for 
    // Google Apps for Work/EDU accounts whose admin has setup domain-wide 
    // delegation: 
    // https://developers.google.com/identity/protocols/OAuth2ServiceAccount#delegatingauthority 
    .setSubject(email) 

    // Set the property store where authorized tokens should be persisted. 
    .setPropertyStore(PropertiesService.getScriptProperties()) 

    // Set the scope. This must match one of the scopes configured during the 
    // setup of domain-wide delegation. 
    .setScope(scope); 

} 

내 서명의 결과는이이었다

Gmail Signature Image