Google Apps Script Cannot Find the Script Function sendEmails Error

Asked 1 years ago, Updated 1 years ago, 69 views

I would like to create a system where I can display what was sent in the form on the spreadsheet and send the message body that I made in the document in bulk using the email address and name in it.

When I try to send it,

Message Details
The script function sendEmails could not be found.For more information, visit https://developers.google.com/apps-script/reference/base/menu#addItem(String,String).

I got an error.

However, I tried many things, but I didn't know what was wrong or what to do.

It would be great if even beginners of the program could understand it.

Below is the code.

function myFunction(){
  Browser.msgBox("Hello" + Session.getEffectiveUser().getEmail());
}

function myFunction() {
  varSheetName=SpreadsheetApp.getActiveSheet();
  varSheetRow=SheetName.getDataRange().getLastRow();

  /* Obtain the document "Mail Body Test"*/
  var docMail= DocumentApp.openById("1********8"; // Document ID
  varstrDoc=docMail.getBody().getText();

  /* Insert first name and last name for all lines of the sheet and display in the log
  for(vari=2;i<=SheetRow;i++){
    var strToAd = SheetName.getRange(i,2).getValue();
    varstrName=SheetName.getRange(i,3).getValue();
    var strBody = strDoc.replace(/{name}/g, strName);

    /* Prepare email title, from address, sender name*/
    var strSubj="************";// Title
    var strFrom = "************"; // From address
    var strSend="**************"; // Name of sender

    /* Send Mail*/
    GmailApp.sendEmail(strToAd, strSubj, strBody, {
      from —strFrom,
      name —strSend
    });
  }
}

javascript google-apps-script

2022-09-30 21:40

2 Answers

The error message
Script function sendEmails not found
Code written in comment section

GmailApp.sendEmail(strToAd, strSubj, strBody, {from:strFrom, name:strSend}); 

Isn't it because I mistyped where I should use the "sendEmail" function like in and wrote "sendEmail"?

Google App Script has a "sendEmail" function, but it doesn't have a "sendEmail" function, so I think it's a matter of course that the error message 'sendEmail function cannot be found'.

===

 "When I wrote ""sendEmail"", I ended up writing ""sendEmail"" (there was an extra s in the end)


 "·Find the string ""sendEmails"" in the program that caused the problem."
 "·If that is where you should use ""sendEmail"", correct it (remove the extra last character ""s""

"


2022-09-30 21:40

Thank you very much for the details!
SendEmail is used only by

GmailApp.sendEmail(strToAd, strSubj, strBody, {from:strFrom, name:strSend});

It seems that it is only at the place whereI checked it with my own eyes and searched DreamWeaver, but I couldn't find it.

Is there a description that is lacking in the sauce?
I brought it from various articles and tried to replace it, but I usually get this error.

For more information, see https://developers.google.com/apps-script/reference/base/menu#addItem(String,String)

See .

I think I don't understand it because it's a Google translation, but I thought it might be a case or lowercase problem, but I didn't understand the rules of code, so I tried to find them in a consistent way with other parts, but I couldn't find them.

Or are there any other settings, splet sheets, or documents that need to be written in the script editor?The article I came across didn't mention the script editor for that setting, so I'm looking for it now.

If you have any questions, please let me know.


2022-09-30 21:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.