๐Ÿ“ "Contact Me" ๋ฉ”์„ธ์ง€ ๋ณด๋‚ด๊ธฐ ๊ธฐ๋Šฅ - Google Apps Mail, ์ •์  HTML Form

Boriยท2022๋…„ 1์›” 10์ผ
6

์–ด์จŒ๋“  ๊ณต๋ถ€

๋ชฉ๋ก ๋ณด๊ธฐ
2/41

Google Apps Mail์„ ์‚ฌ์šฉํ•ด ์ •์  HTML Form์—์„œ ๋ฉ”์ผ์„ ๋ณด๋‚ด์„ธ์š”! ๋ฅผ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค.

๐Ÿ—’ ๋ฐฑ์—”๋“œ ์„œ๋ฒ„ ์—†์ด Google ์Šคํฌ๋ฆฝํŠธ๋ฅผ ํ™œ์šฉํ•ด "Contact Me" ๋ฉ”์‹œ์ง€ ๋ณด๋‚ด๊ธฐ ๊ธฐ๋Šฅ ๊ตฌํ˜„

  • ๋ฐฑ์—”๋“œ๊ฐ€ ํ•„์š” ์—†๋‹ค.
  • ์ปค์Šคํ„ฐ๋งˆ์ด์ง•์ด ๊ฐ€๋Šฅํ•˜๋‹ค.
  • Google mail์„ ํ†ตํ•ด ์ด๋ฉ”์ผ์„ ์ „์†กํ•œ๋‹ค.
  • ๋ฐ์ดํ„ฐ๋ฅผ ์‰ฝ๊ฒŒ ๋ณผ ์ˆ˜ ์žˆ๋Š” ์Šคํ”„๋ ˆ๋“œ ์‹œํŠธ์— ์ˆ˜์ง‘/์ €์žฅํ•œ๋‹ค.

๐Ÿ—’ ์‚ฌ์šฉ๋ฐฉ๋ฒ•

1. Sample Spreadsheet ๋ณต์‚ฌ

Sample Spreadsheet :
https://docs.google.com/spreadsheets/d/1Bn4m6iA_Xch1zzhNvo_6CoQWqOAgwwkOWJKC-phHx2Q/copy

  • Sample Spreadsheet ๋งํฌ ํด๋ฆญ

  • ์‚ฌ๋ณธ ๋งŒ๋“ค๊ธฐ ํด๋ฆญ > ์•„๋ž˜์˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด ๋ณต์‚ฌ๋ณธ์ด ์ƒ์„ฑ
    • ๋ณต์‚ฌ๋ณธ์˜ ์ œ๋ชฉ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅ

  • ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ > App Script

  • ์ƒˆ๋กœ์šด Apps Script ํŽธ์ง‘๊ธฐ ์‚ฌ์šฉํ•˜์ง€ ๋ง๊ณ  ๋‹ซ๊ธฐ ํด๋ฆญ

์œ„์˜ ์ฐฝ์ด ๋œจ์ง€ ์•Š๊ณ  ์•„๋ž˜์™€ ๊ฐ™์ด ๋‚˜ํƒ€๋‚œ๋‹ค๋ฉด ์ด์ „ ํŽธ์ง‘๊ธฐ ์‚ฌ์šฉ ํด๋ฆญ

=> Editor Opt-out Survey ์ฐฝ์ด ๋œจ๋Š”๋ฐ ์ €๋Š” ๊ทธ๋ƒฅ ๋‹ซ์•„๋ฒ„๋ ธ์Šต๋‹ˆ๋‹ค.

2. TO_ADDRESS ์„ค์ •ํ•˜๊ธฐ

  • // var TO_ADDRESS = "example@email.net"; ๋ถ€๋ถ„์˜ ์ฃผ์„์„ ํ’€๊ณ , example@email.net์— ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ›์„ ์ž์‹ ์˜ ์ด๋ฉ”์ผ ์ฃผ์†Œ๋ฅผ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.

    ๊ฒฝ๊ณ : ๋งŒ์•ฝ ๋‹น์‹ ์ด TO_ADDRESS ์— ์žˆ๋Š” ์ฃผ์„์„ ์ œ๊ฑฐํ•˜์ง€ ์•Š๊ณ , TO_ADDRESS์— ๋‹น์‹ ์˜ ์ด๋ฉ”์ผ์„ ์ง์ ‘ ์„ค์ •ํ•˜๋ฉด, ์›น ์Šคํ‚ฌ์„ ๊ฐ€์ง„ ์‚ฌ๋žŒ์ด ๋‹น์‹ ์˜ Form๊ณผ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ •ํ•˜์—ฌ ์ž„์˜์˜ ์ด๋ฉ”์ผ๋กœ ๋ณด๋‚ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด ์œ„ํ—˜์€ ๊ทธ๋‹ค์ง€ ํฌ์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋Œ€์‹ , ์ด ๊ฐ€๋Šฅํ•œ ์œ„ํ—˜์„ ๊ฐ์ˆ˜ํ•˜๋ฉด์„œ๋„ HTML Form ๋‚ด์—์„œ ์ด๋ฉ”์ผ ๋ณ€์ˆ˜๋ฅผ data-email ์†์„ฑ์œผ๋กœ ์„ค์ •ํ•˜๋Š”๊ฒŒ ํŽธํ•˜๋‹ค๋ฉด ์ด ๋ณ€์ˆ˜๋ฅผ ์ฃผ์„์œผ๋กœ ๋‚จ๊ฒจ๋‘˜ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

3. ์Šคํฌ๋ฆฝํŠธ ์ƒˆ๋กœ์šด ๋ฒ„์ „ ์ƒ์„ฑ ๋ฐ ๋ฒ„์ „ ๊ด€๋ฆฌ

  • ํŒŒ์ผ > ๋ฒ„์ „๊ด€๋ฆฌ > ๋ฒ„์ „์— ๋Œ€ํ•œ ์„ค๋ช… ์ž‘์„ฑ ํ›„ Save new version ํด๋ฆญ > ํ™•์ธ

4. ์—…๋ฐ์ดํŠธ ๋œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์›น์•ฑ์œผ๋กœ ๋ฐฐํฌ

  • ๊ฒŒ์‹œ > ์›น ์•ฑ์œผ๋กœ ๋ฐฐํฌ > ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์„ ํƒ > ์—…๋ฐ์ดํŠธ

  • Authorization required ๊ถŒํ•œ ๊ฒ€ํ†  > ์ด๋ฉ”์ผ์„ ๋ณด๋‚ด๊ธฐ ์œ„ํ•ด ์Šคํฌ๋ฆฝํŠธ ์ธ์ฆ > Google์„ ํ™•์ธํ•˜์ง€ ์•Š์€ ์•ฑ, "Advanced(๊ณ ๊ธ‰)"๊ณผ "Go to(์ด๋™) ... (unsafe)"์„ ํด๋ฆญํ•ด์„œ ์ด ์•ฑ ๊ถŒํ•œ์„ ๋ถ€์—ฌ > ํ—ˆ์šฉ

  • Current web app URL ๋ณต์‚ฌ

5. ๊ธฐ๋ณธ HTML Form ๋งŒ๋“ค๊ธฐ

  • Form ํƒœ๊ทธ์— class="gform" ์ง€์ •
    => ํด๋ž˜์Šค ๋ช…์„ ๋ณ€๊ฒฝํ•  ๋•Œ, form-submission-handler.js์˜ gform์œผ๋กœ ์ง€์ •๋œ ํด๋ž˜์Šค ๋ช…๋„ ๊ฐ™์ด ๋ณ€๊ฒฝํ•ด์ฃผ๊ธฐ
    => ์Šคํƒ€์ผ ์ ์šฉ
<section class="email-me">
  <h2 class="title-section">Email Me!</h2>
  <form class="gform" action="https://script.google.com/macros/s/AKfycbzBT3MM8mpiWutlwJX4p4PyhJI0zPihVy7IXkMYq3o5OMu5AOXQ/exec" method="POST" data-email="qhflrnfl4324@gmail.com">
    <fieldset>
      <div class="box-input">
        <label for="userName">Name plz:)</label>
        <input type="text" id="userName" name="name" placeholder="์ด!๋ฆ„!" required>
      </div>
      <div class="box-input">
        <label for="userEmail">Email Address</label>
        <input type="email" id="userEmail" name="email" placeholder="์ด!๋ฉ”!์ผ!" required>
      </div>
      <div class="box-input">
        <label for="userMessage">Message</label>
        <textarea name="message" id="userMessage" required></textarea>
      </div>
      <div class="box-input">
        <button type="submit" class="btn-send">Send Message</button>
      </div>
    </fieldset>
  </form>
  </div>
</section>

  • ์ด๋ฆ„, ์ด๋ฉ”์ผ, ๋ฉ”์‹œ์ง€ ์ž‘์„ฑ ํ›„ Send Message ํด๋ฆญ > ํŽ˜์ด์ง€๊ฐ€ ๋„˜์–ด๊ฐ€๋ฉด์„œ JSON ์‘๋‹ต/๊ฒฐ๊ณผ๊ฐ€ ๋ณด์—ฌ์ง„๋‹ค. > ์Šคํ”„๋ ˆ๋“œ์‹œํŠธ์—์„œ ๋ฐ›์€ ๋ฉ”์‹œ์ง€์— ๋Œ€ํ•œ ์ •๋ณด ์ €์žฅ / ์„ค์ •ํ•œ ์ด๋ฉ”์ผ ๊ณ„์ •์˜ ๋ฐ›์€ ํŽธ์ง€ํ•จ์—์„œ ๋ฉ”์‹œ์ง€ ํ™•์ธ

6. JavaScript "AJAX ์„ ์ด์šฉํ•œ Form Submit"

  • ํŽ˜์ด์ง€๊ฐ€ JSON ์‘๋‹ต/๊ฒฐ๊ณผ๋กœ ๋ณ€๊ฒฝ๋˜์ง€ ์•Š๋„๋ก ํ•˜๊ธฐ ์œ„ํ•ด, AJAX๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Form์„ submit ํ•œ๋‹ค.
    • the following Javascript file์„ form-submission-handler.js ์œผ๋กœ ์ €์žฅ
    • index.html์— ์•„๋ž˜์˜ ์ฝ”๋“œ ๋„ฃ๊ธฐ
<script data-cfasync="false" type="text/javascript" src="form-submission-handler.js"></script>

7. Form์„ Submit ํ•œ ํ›„, ๋‚˜์˜ค๋Š” ๋ฉ”์‹œ์ง€ ์ปค์Šคํ„ฐ๋งˆ์ด์ง•ํ•˜๊ธฐ

  • <div style="display:none" class="thankyou_message"></div> ์•ˆ์— ์›ํ•˜๋Š” ๋ฉ”์‹œ์ง€๋กœ ์ž‘์„ฑ
<div style="display:none" class="thankyou_message">
 <!-- You can customize the thankyou message by editing the code below -->
 <p>์—ฐ๋ฝ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋น ๋ฅธ ์‹œ์ผ ๋‚ด์— ๋‹ต๋ณ€ ๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค๐Ÿš€</p>
 </h2>
</div>
  • ์ž‘์„ฑํ–ˆ๋˜ ๋‚ด์šฉ์ด ์ดˆ๊ธฐํ™”๋˜๋ฉด์„œ ํ•˜๋‹จ์— submit ๋ฉ”์‹œ์ง€๊ฐ€ ๋‚˜ํƒ€๋‚œ๋‹ค.

3๊ฐœ์˜ ๋Œ“๊ธ€

comment-user-thumbnail
2022๋…„ 1์›” 10์ผ

์šฐ์•™~ ์ •๋ณด ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹น๐Ÿ’™

1๊ฐœ์˜ ๋‹ต๊ธ€
comment-user-thumbnail
2022๋…„ 9์›” 19์ผ

ํ•ด๋‹น ํผ์„ ๋”ฐ๋กœ ์Šคํƒ€์ผ๋ง ํ•  ์ˆ˜ ์žˆ๋‚˜์š”? ์—ฐ๋ฝ์ฒ˜ ํ•ญ๋ชฉ์„ ์ถ”๊ฐ€ํ•œ๋‹ค๋˜์ง€, css์Šคํƒ€์ผ๋ง์„ ๋”ฐ๋กœ ํ•  ์ˆ˜ ์žˆ๋Š”๊ฒƒ์ธ์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค. (ํฌ๊ธฐ๋ณ€๊ฒฝ์ด๋‚˜ ์„œ์ฒด๋ณ€๊ฒฝ ๋“ฑ๋“ฑ )

๋‹ต๊ธ€ ๋‹ฌ๊ธฐ