How to Send Automatic Emails from Google Forms with Apps Script

Поделиться
HTML-код
  • Опубликовано: 3 дек 2024

Комментарии • 4

  • @boxonman
    @boxonman 26 дней назад +1

    Superb
    love this tool
    you are great and generous

  • @YouAreWorthCelebrating
    @YouAreWorthCelebrating 28 дней назад +2

    This video was perfect timing! I am trying to send an html email automatically from google forms. Does it work the same way as your video about sending automated personal emails 2 months ago? I am not familiar with coding, and I am trying to paste in code for an html email but keep getting the error "Syntax error: SyntaxError: Invalid or unexpected token line: 32 file: Code.gs" Any suggestions?

    • @PeterHornerGoogleTech
      @PeterHornerGoogleTech  27 дней назад +1

      Hi! Thanks for the feedback! Here is some example code which sends an HTML email. Just replace the existing sendEmail function with this:
      function sendEmail(name, email, attending) {
      // Set up email subject and basic body
      let subject = "RSVP Confirmation";
      let body = `Hi ${name},Thank you for your RSVP!`;
      // Customize email based on RSVP response
      if (attending === "Yes") {
      subject += ": You're Confirmed!";
      body += `We're excited to see you at the event! Here are the details:
      Date: [Date of event]
      Time: [Time of event]
      Location: [Location of event]
      Other details: [Any other important details]
      `;
      } else if (attending === "No") {
      body += "Thank you for letting us know. We hope to see you next time!";
      } else if (attending === "Maybe") {
      body += "We understand you might not be sure yet. Please let us know by the end of the month if you can make it.";
      }
      // Send the email with HTML body
      MailApp.sendEmail({
      to: email,
      subject: subject,
      htmlBody: body
      });
      }

  • @jonathananderson9370
    @jonathananderson9370 День назад

    TypeError: Cannot read properties of undefined (reading '0')
    at formResponse(Code:8:51)?