How to Make Google Form Send Email Multiple People

I want multiple people to receive a response when the form is submitted.

Description

This script provides instructions on how to make google form send email to multiple people when the form is submitted. Email address, subject, and message body are taking from an extra sheet in the spreadsheet called Settings.

Directions on Use

1. Create an extra sheet in the Spreadsheet called settings.

2. Set-up the headings of the Settings page like below:

3. Fill out the Email, Email Subject, and Message. You can enter multiple emails here, but only one Subject/Message.

4. Install the How to Make Google Form Send Email script with the directions below.

Code (see further instructions below the code):

//using the obtained settings to set up email info
function onOpen(e) {
   FormApp.getUi().createMenu('Authorizer').addItem('Authorize', 'authorize').addToUi();
      
 }
 
//Easily authorize script to run from Form Editor interface
function authorize(){
 
var respEmail = Session.getActiveUser().getEmail();
 
  MailApp.sendEmail(respEmail,"Form Authorizer", "Your form has now been authorized to send you emails");
 
}
//grabbing general settings from spreadsheet sheet Settings
function getSettings() {
  var form = FormApp.getActiveForm();
  var ssID = form.getDestinationId();
  var ss = SpreadsheetApp.openById(ssID);
  var sheet = ss.getSheetByName("Settings");
  var lastRow = sheet.getLastRow();
  var lastColumn = sheet.getLastColumn();
  var range = sheet.getRange(1,1,lastRow,lastColumn);
  var values = range.getValues();
  return values;  
}
 
//build email
function sendEmail(){
  var emailSettings = getSettings();
  var emails = [];
  var subject = emailSettings[1][1];
  var message = emailSettings[1][2];
  
 try{
   
  for (i in emailSettings){
    var email = emailSettings[i][0];
    if (email != 'Email'){
      emails.push(email);
     }
  }
  
  Logger.log(emails +' ' +subject + ' ' +message);
   MailApp.sendEmail(emails,subject,message);
   
 }
  catch (e) {
    MailApp.sendEmail(Session.getActiveUser().getEmail(), "Error report",
      "rnMessage: " + e.message
      + "rnFile: " + e.fileName
      + "rnLine: " + e.lineNumber);
  }
  
}

Install Script

1. Open Script Manager by going to Tools->Script Manager in the Form Editor.

2. Copy the above code into the Script Manager (don’t forget to save!).

4. Authorize the script to run by going back to the Form Editor, refreshing it, and selecting
Settings->Authorize. You will be prompted to Authorize and receive and email.

5. Set-up the triggers so that the script runs when the form is submitted.

  • Open up the Script Manager (see above).
  • Select the trigger icon.
  • Set-up the trigger like the picture below:

 

You May Also Like

About the Author: shodg001

Leave a Reply