Last active
March 2, 2022 03:27
-
-
Save hiimivantang/aef358b6c26715ee628920b43d1f5f61 to your computer and use it in GitHub Desktop.
Send confirmation email and invite
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 sendEmail(e) { | |
var subject = "Confirmation Message" | |
var message = "Hello! this is a test email!" | |
var old_value = e.oldValue | |
var new_value = e.value | |
console.log(e.range.rowStart) | |
console.log(e.range.rowEnd) | |
console.log(e.range.columnStart) | |
console.log(e.range.columnEnd) | |
console.log(old_value) | |
console.log(new_value) | |
if(new_value != old_value){ | |
GmailApp.sendEmail(new_value, subject, message) | |
} | |
} |
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 sendEmail(e) { | |
var name = e.namedValues["First Name"] | |
var email = e.namedValues["Email Address"] | |
var sessions = e.namedValues["Which session are you attending?"] | |
var subject = "Confirmation Message" | |
var message = "Hello " + name + ", \n\n" + "This is a confirmation message to let you know we received your form submission.\n\nYou have selected the following sessions:\n" + sessions.join('\n') + "\n\nHere's the zoom link for all sessions: <INSERT ZOOM LINK HERE>" | |
//GmailApp.sendEmail(email, subject, message) | |
GmailApp.sendEmail(email, subject, message, {cc: "cc1@email.com,cc2@email.com"}) | |
add_guests_to_event(email,<EVENT_ID>) | |
} | |
function add_guests_to_event(email, eventId) { | |
let calendarId = 'primary'; // ID of calendar containing event | |
var event = Calendar.Events.get(calendarId, eventId); | |
var attendees = event.attendees; | |
attendees.push({email: email}); | |
var resource = { attendees: attendees }; | |
var args = { sendUpdates: "all" }; | |
Calendar.Events.patch(resource, calendarId, eventId, args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
_send_email.gs
into the editor and save it.Test by inserting an email address in one of the cells and monitor if the script was triggered in
Executions
page within Apps Script UI.