Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Peds87

Scrip envio de respostas por email

Recommended Posts

Olá. Preciso de ajuda se faz favor. Estou utilizando o google forms e tenho script vai enviar email sempre que haja uma resposta nova mas sempre que acontece envia também 3 emails em brancos (só o formulário, sem respostas). Alguém me pode ajudar?? O Script que estou utilizando é este 

 

 

function sendFormByEmail(e) { var emailSubject = "NEW POSITION"; // Set with your email address or a comma-separated list of email addresses. var yourEmail = "XXX@HOTMAIL.COM"; // Set with your spreadsheet's key, found in the URL when viewing your spreadsheet. var docKey = "dEqXbwtgTGGTerddexZYmuk"; // If you want the script to auto send to all of the spreadsheet's editors, set this value as 1. // Otherwise set to 0 and it will send to the yourEmail values. var useEditors = 0; if (useEditors) { var editors = DocsList.getFileById(docKey).getEditors(); if (editors) { var notify = editors.join(','); } else var notify = yourEmail; } else { var notify = yourEmail; } var s = SpreadsheetApp.getActive().getSheetByName("SENT"); var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0]; var message = ""; for(var i in headers) {  message += headers + ' : '+ e.namedValues[headers].toString() + '\n\n'; } MailApp.sendEmail(notify, emailSubject, message);  }

 

 

Obrigado! 

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.