Last active
August 29, 2015 13:57
-
-
Save Villanuevand/9745625 to your computer and use it in GitHub Desktop.
sendMailToFormSubmit es un pequeño script desarrollado utilizando GAS (Google App Script) para extender las funcionalidad de los formularios de Google. Envía un correo electrónico automáticamente cada vez que alguien responda el formulario.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendMailOnFormSubmit(e) { | |
var recipient = "[email protected]"; | |
var copyTo = "[email protected]" | |
//Opciones del formulario. | |
var timeStamp = e.values[0]; | |
var name = e.values[1]; | |
var email = e.values[2]; | |
var knowledge = e.values[3]; | |
var languages = e.values[4]; | |
var subject = name + " ha respondido el formulario." | |
// Cuerpo del mensaje texto plano. | |
var mailBody = "Una nueva respuesta ha sido agregada." | |
+ "\nEnviado: " + timeStamp | |
+ "\nCandidato: " + name | |
+ "\nCorreo Electronico: " + email | |
+ "\nConocimientos Desarrollo Web basico: " + knowledge | |
+ "\nLenguajes que domina: " + languages; | |
// Cuerpo del mensaje html. | |
var htmlBody ="<h1>Una nueva entrada ha sido agregada</h1>" | |
+ "<ul>" | |
+ "<li>Enviado:"+ timeStamp + "</li>" | |
+ "<li>Candidato: "+ name +"</li>" | |
+ "<li>Correo Electronico: "+ email +"</li>" | |
+ "<li>Conocimientos Desarrollo Web basico: "+ knowledge +"</li>" | |
+ "<li>Lenguajes que domina: "+ languages +"</li>" | |
+ "</ul>"; | |
//Opciones Avanzadas. | |
var advanced = {name: "Form - Encuesta Desarrolladores",htmlBody:htmlBody, cc : copyTo}; | |
MailApp.sendEmail(recipient, subject, mailBody, advanced); | |
} | |
/* Implementación | |
* En el Editor -> Resources -> Current project´s triggers: | |
* RUN: sendMailOnFormSubmit | |
* EVENT: from spreadsheet -> On form submit | |
* Para más información sobre Google Apps Script visita => https://developers.google.com/apps-script/ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment