From the Google form spreadsheet, I set up the Tools > Script Editor edit to receive an automated reply email when I submit the form.(See script, trigger settings at the bottom)
It worked fine for a while, but after one person submitted the form, an error email with the following subject line was sent to the administrator's email, and the automatic reply email was not sent to the email address of the form sender.Once this error occurs, the same error occurs for subsequent submitters.
Subject: [Failure] No email address specified on Google form
Sentence Only the question items on the form are written in a blank format
If this error occurs, we are currently taking temporary action as follows, but we would like to identify the cause and resolve it fundamentally.
·The answer spreadsheet contains all the answers, including the email address, so you can manually create and send a confirmation email (it will take a lot of time if there are many)
·Re-designate a new spreadsheet to answer to
(I have to notify my co-editor every time, so I would like to avoid it if possible.)
·As it has been functioning normally up until now, I don't think there is a problem with the script description.
"·The contents of the error message are that the email address is not specified, but the email address is a required item, so it is hard to imagine that the email address was sent blank."
·As I add items that are not on the form to the last column of the spreadsheet and use them instead of the remarks column, is it possible that this could cause any errors...?
MyFunction>From spreadsheet>When submitting the form
function myFunction(){
}
//------------------------------------------------------------
// Configuration Area From Here
//------------------------------------------------------------
// Subject, Body, Footer
var subject="Thank you for your reservation";
var body
= Thank you for your reservation.\n\n"
+ "We have received your inquiry with the following information, so please check it."\n"
+ "------------------------------------------------------------------------------------------------------
var footer
= "----------------------------------------------------------------------------------------------------------
// Specifying the Input Column Name
varNAME_COL_NAME = 'Parental Name (Chinese characters)';
varMAIL_COL_NAME = 'Mail Address';
var TIMESTAMP_LABEL = 'Time stamp';
// Mail To
var admin="xxx@xxxxxx"; // Administrator (required)
varcc="; // Cc:
var bcc="xxx@xxxxxx"; // Bcc:
var reply="xxx@xxxxxx"; // Reply-To:
var to = "; // To: (The address of the input person is automatically entered)
//------------------------------------------------------------
// Configuration Area Up to here
//------------------------------------------------------------
try{
// Working with Spreadsheets
varsh=SpreadsheetApp.getActiveSheet();
varrows = sh.getLastRow();
varcols=sh.getLastColumn();
varrg = sh.getDataRange();
Logger.log("rows="+rows+"cols="+cols);
// Email subject/text creation and destination email address acquisition
for(varj=1;j<=cols;j++){
varcol_name = rg.getCell(1,j).getValue(); // Column Name
varcol_value=rg.getCell(rows,j).getValue(); // Input value
if(col_name===NAME_COL_NAME) {// Put your name at the beginning of the mail body
body=col_value+"Dear\n\n"+body;
}
if(col_name===MAIL_COL_NAME) {// Email Address
to=col_value;
}
if(col_name===TIMESTAMP_LABEL) {//Time stamp 申込 Application date and time
col_name = 'Application date and time';
}
body+="["+col_name+"]\n";
body+=col_value+"\n\n";
}
body+=footer;
// Destination Options
var options={};
if(cc)options.cc =cc;
if(bcc) options.bcc = bcc;
if(reply)options.replyTo=reply;
// sending an e-mail
if(to){
MailApp.sendEmail(to, subject, body, options);
} else {
MailApp.sendEmail(admin, "[Failure] No email address specified in Google form", body);
}
}catch(e){
MailApp.sendEmail(admin, "[Failure] Error sending mail from Google form", e.message);
}
I'm groping without any program experience, so I think there are some parts that are difficult to read or lacking.I don't have any IT people nearby... Please point it out and let me know.
Summary: After a while, a summary of the errors was sent.
error message
·Script function not found myFunction
·Too many times a day I ran service email.(line 105, file "code")
It's been a while, but has this matter been resolved?
It seems that myFunction of the script I am writing is suddenly closed?
function myFunction(){
}
© 2024 OneMinuteCode. All rights reserved.