Apps Script 빠른 시작
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
이 도움말에서는 Apps Script를 사용하여 스키마가 포함된 이메일을 자신에게 보내 이메일 마크업을 테스트하는 방법을 보여줍니다.
프로젝트 만들기
script.google.com을 방문합니다. script.google.com
을 처음 방문하는 경우 정보 페이지로 리디렉션됩니다. 스크립트 작성 시작을 클릭하여 스크립트 편집기로 이동합니다. 스크립트 편집기에서 빈 프로젝트의 스크립트를 만듭니다.
Code.gs
의 코드를 다음으로 바꿉니다.
파일 > 새로 만들기 > HTML 파일을 선택하여 새 HTML 파일을 만듭니다. 위의 JavaScript의 매개변수와 일치하도록 파일 이름을 mail_template
로 지정합니다. HTML 파일의 콘텐츠를 다음으로 바꿉니다.
스크립트 테스트
스크립트를 테스트하려면 다음 단계를 따르세요.
- 프로젝트를 저장합니다.
Code.gs
탭을 선택합니다.
Select function
드롭다운 메뉴에서 testSchemas
함수가 선택되어 있는지 확인합니다.
- Apps Script 개발 환경에서
Run
를 클릭합니다.
스크립트를 처음 실행하면 승인을 부여하라는 메시지가 표시되며, 승인을 부여한 후 스크립트를 다시 실행해야 합니다. 스크립트를 실행한 후 받은편지함에서 다음 스크린샷과 같이 작업으로 이동 버튼이 포함된 이메일을 확인합니다.
스크립트는 어떻게 작동하나요?
testSchemas
함수는 mail_template.html
이라는 파일에서 HTML 콘텐츠를 읽고 현재 인증된 사용자에게 이 콘텐츠를 이메일로 전송합니다. Google에 등록에 설명된 대로 자신에게 전송하는 모든 스키마가 Gmail에 표시되므로 스크립트에서 전송한 이메일을 사용하여 테스트 목적으로 등록 요구사항을 무시할 수 있습니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-29(UTC)
[null,null,["최종 업데이트: 2025-08-29(UTC)"],[],[],null,["# Apps Script Quickstart\n\nThis article shows you how to use [Apps Script](/apps-script) to send yourself an email with schemas in order to test email markup.\n\nCreating the project\n--------------------\n\nVisit [script.google.com](https://script.google.com). If this is the first time you've been to `script.google.com`, you'll be redirected to an information page. Click **Start Scripting** to proceed to the script editor. In the script editor, create a script for a **Blank Project**.\n\nReplace the code in `Code.gs` with the following: \ngmail/markup/Code.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/gmail/markup/Code.gs) \n\n```javascript\n/**\n * Send an email with schemas in order to test email markup.\n */\nfunction testSchemas() {\n try {\n const htmlBody = HtmlService.createHtmlOutputFromFile('mail_template').getContent();\n\n MailApp.sendEmail({\n to: Session.getActiveUser().getEmail(),\n subject: 'Test Email markup - ' + new Date(),\n htmlBody: htmlBody\n });\n } catch (err) {\n console.log(err.message);\n }\n}\n```\n\nSelect **File \\\u003e New \\\u003e Html file** to create a new HTML file. Name the file `mail_template` to match the parameter in the JavaScript above. Replace the content of the HTML file with the following: \ngmail/markup/mail_template.html \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/gmail/markup/mail_template.html) \n\n```html\n\u003c!--\n Copyright 2022 Google LLC\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n--\u003e\n\n\u003chtml\u003e\n \u003chead\u003e\n \u003cscript type=\"application/ld+json\"\u003e\n {\n \"@context\": \"https://schema.org\",\n \"@type\": \"EmailMessage\",\n \"description\": \"Check this out\",\n \"potentialAction\": {\n \"@type\": \"ViewAction\",\n \"target\": \"https://www.youtube.com/watch?v=eH8KwfdkSqU\"\n }\n }\n \u003c/script\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n \u003cp\u003e\n This a test for a Go-To action in Gmail.\n \u003c/p\u003e\n \u003c/body\u003e\n\u003c/html\u003e\n```\n\nTesting the script\n------------------\n\nTo test the script:\n\n1. Save the project.\n2. Select the tab for `Code.gs`.\n3. Make sure the function `testSchemas` is selected in the `Select function` dropdown menu.\n4. Click `Run` in the Apps Script development environment.\n\nThe first time you run the script you'll be asked to grant authorization, after which you should re-run it. After the script runs, check your inbox for an email sent from yourself with a [Go-To Action](/workspace/gmail/markup/reference/one-click-action) button, as in the following screenshot:\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nHow does the script work?\n-------------------------\n\nThe `testSchemas` function reads the HTML content from the file named `mail_template.html` and sends that content as an email to the currently authenticated user. As explained in [Registering with Google](/workspace/gmail/markup/registering-with-google), all schemas you send to yourself will be displayed in Gmail, so the email sent by the script can be used to ignore the registration requirements for testing purposes."]]