Can someone help me with this code? Why is not working?

// Auto-Confirmation Email to submitter

// THE SIMPLEST WAY

   function AutoConfirmation(e){
      var theirFirst = e.values[2];
      var theirEmail = e.values[5];
      var theEvent = e.values[1];
      var subject = "Form Submitted";
      var message = "Thank you, " + theirFirst + " for the expressed interest in our " + theEvent;

   MailApp.sendEmail (theirEmail, subject, message);
   }

TypeError: No se puede leer la propiedad "values" de undefined. (línea 6, archivo "Código")

I think you meant to use value not values, also you seem to be missing the target

e.target[0].value

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums