Created
May 18, 2012 19:50
-
-
Save brunosan/2727288 to your computer and use it in GitHub Desktop.
Reminder email
This file contains hidden or 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
| agenda = UrlFetchApp.fetch("URL to pdf, in Dropbox").getBlob().setName("Agenda.pdf"), //agenda | |
| paper = UrlFetchApp.fetch("URL to pdf, in Dropbox").getBlob().setName("Discussion Paper.pdf"), // Paper | |
| logistics = UrlFetchApp.fetch("URL to pdf, in Dropbox").getBlob().setName("Logistics.pdf") //logistics | |
| for (var i = 0; i < data.length; ++i) { | |
| var row = data[i]; | |
| if ((row.attending9Am == CONFIRMED) || | |
| (row.attending9Lunch == CONFIRMED) || | |
| (row.attending9Pm == CONFIRMED) || | |
| (row.attending10Am == CONFIRMED) || | |
| (row.attending10Lunch == CONFIRMED)|| | |
| (row.attending10Pm == CONFIRMED)) { | |
| if (row.reminder == "No") { | |
| sendEmail=1; | |
| var message = "<HTML><BODY>" | |
| + '<img align="middle" width="150px" src="http://gain.org/images/gainlogo.png"><br>' | |
| + "<br><p align='left'> May 7, "+Utilities.formatDate(new Date(), 'GMT', 'yyyy')+"</p>" | |
| + "<p>Dear " + row.prefix + " " + row.lastName + ", <p> " | |
| + '<p>We look forward to your participation REST OF THE EMAIL' | |
| + "<p>In preparation for the event, please find attached the:" | |
| + "<ul><li>GAIN 2012 Annual Meeting & Scientific Convening Agenda" | |
| + "<li>GAIN Index 2012 Discussion Paper</ul>" | |
| + "(No need to print - it will be part of your welcome package.)" | |
| + '<p> Our records indicate that you have confirmed for the following sessions. Please advise us of any changes by replying to this email.<p> <ol>' | |
| +((row.attending9Am == CONFIRMED)? "<li> May 9 morning" : "") | |
| +((row.attending9Lunch == CONFIRMED)? "<li> May 9 lunch" : "") | |
| +((row.attending9Pm == CONFIRMED)? "<li> May 9 afternoon" : "") | |
| +((row.attending9Recepcion == CONFIRMED)? "<li> May 9 Reception" : "") | |
| +((row.attending10Am == CONFIRMED)? "<li> May 10 morning" : "") | |
| +((row.attending10Lunch == CONFIRMED)? "<li> May 10 lunch" : "") | |
| +((row.attending10Pm == CONFIRMED)? "<li> May 10 afternoon" : "") | |
| + '</ol><p>' | |
| +((row.vegetarian == "Vegetarian")? "(We have also noted you as a vegetarian.)": "") | |
| + "<p> REST OF THE EMAIL" | |
| + "</HTML></BODY>"; | |
| Log+="(+"+delay()+" s.) SENDING reminder for "+row.firstName+" "+row.lastName+". Group 1.<br>"; | |
| MailApp.sendEmail(row.email, | |
| "Event documents: Global Adaptation Institute (GAIN) 2012 Annual Meeting & Scientific Convening", | |
| "", | |
| { | |
| htmlBody: message, | |
| attachments: | |
| [ | |
| agenda, //agenda | |
| paper, // Paper | |
| logistics //logistics | |
| ], | |
| bcc: MANAGER_EMAIL | |
| }); | |
| sheet.getRange(row.id+2, COLUMN_REMINDER).setValue("Yes"); | |
| row.reminder = "Yes"; | |
| } | |
| SpreadsheetApp.flush(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment