title: Send Email after Form is Edited
body: <p>I have a Google form that works great.  Inside that form i also have scripts written up that send out emails.  These also work great.</p>
  
  <p>What i dont have is a way to make those scripts trigger and run on their own.  For now, when the form is edited, i get a notification email.  I then have to log into the spreadsheet and manually run my email script(s).  </p>
  
  <p>I want the spreadsheet to run the scripts automatically and send the email when data is added from the form.  I tried the onEdit below but that only works if i have the spreadsheet open and i launch it.  Is there another way to run a script automatically after a form is edited without having to open it up?</p>
  
  <p>Here is a basic email code + my onEdit i tried to make work.</p>
  
  <pre><code>// Ran when the spreadsheet is edited
  function onEdit(){ 
    emailEOnEdit();
  }
  
  // Sends an email when the New User Request Form is edited
  function emailEOnEdit(row){ 
    var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
    var subject = "Test Email On Edit";
    var recipients = "user@domain.com"
    var message = "&lt;HTML&gt;&lt;BODY&gt;" 
      + "&lt;P&gt;" + sheet.getRange("E1").getValues()
      + "&lt;/HTML&gt;&lt;/BODY&gt;"; 
    MailApp.sendEmail(recipients, subject, "", {htmlBody: message});
  }
  </code></pre>