2016-12-22 4 views
0

Ich bin neu beim Erstellen von Skripts, aber ich habe versucht, ein Skript zu schreiben, um eine Nachricht an über 500 E-Mails zu senden, die ich in einem Google-Blatt habe. Ich habe einen Code kopiert, den ich in einem Google-Lernprogramm gefunden habe, und dann versucht, ihn an die entsprechenden Spalten in meinem Arbeitsblatt anzupassen und eine formatierte E-Mail-Nachricht mit Links einzufügen. Alles hat gut funktioniert, bis ich meine benutzerdefinierte Nachricht hinzugefügt habe, jetzt bekomme ich die Fehlermeldung "Fehlt) nach der Argumentliste. (Zeile 28, Datei" Code ")." Zeile 28 ist "MailApp.sendEmail (emailAddress, Betreff, Nachricht);"Google Tabellen E-Mail-Skript Fehler

Ich bin neu, also ist es wahrscheinlich ein einfacher Fehler. Ich habe das vollständige Skript unten eingefügt. Ich schätze jede Hilfe.

var EMAIL_SENT = "EMAIL_SENT"; 

function sendEmails2() { 
    var sheet = SpreadsheetApp.getActiveSheet(); 
    var startRow = 2; // First row of data to process 
    var numRows = 523; // Number of rows to process 
    // Fetch the range of cells A2:F523 
    var dataRange = sheet.getRange(startRow, 1, numRows, 523) 
    // Fetch values for each row in the Range. 
    var data = dataRange.getValues(); 
    for (var i = 0; i < data.length; ++i) { 
    var row = data[i]; 
    var firstName = row[1]; 
    var emailAddress = row[5]; // Sixth column 
    var message = <p>"Hi " + firstName + ",/n Are you looking for new ways to integrate technology into your lessons? Heartland AEA is offering a FREE professional development opportunity focused on integrating technology into Social Studies instruction. As part of our Technology Integration and Collaboration (TIC) series, this session will provide a free opportunity for educators from throughout Heartland's area to learn from exemplary teachers while collaborating with others who are passionate about education, technology, and social studies. We have a great lineup of presenters and would love to have as many educators as possible in attendance. If you are unable to attend in person, please consider participating through the livestream via Zoom.</p> + 
<p>Whether you plan to attend in person or via Zoom, please '<a href=\"' + 'https://prodev.aeapdonline.org/4DCGI/TE099892111701INV&*' + '>register</a> in advance. More information about this and other upcoming TIC sessions can be found on the '<a href=\"' + 'https://sites.google.com/a/heartlandaea.org/heartland-tic/home' + '>TIC website</a>.</p> + 
<p>Topic: 6-12 Social Studies: Quality Instruction Using Technology</p> + 
<p>Date: January 12, 2017 </p> + 
<p>Time: 8:30am - 11:30am </p> + 
<p>Location: Johnston AEA</p> + 
<p>To Register: '<a href=\"' + 'https://prodev.aeapdonline.org/4DCGI/TE099892111701INV&*' + '>Click Here</a>. It is FREE!</p> + 
<p>Zoom Link: '<a href=\"' + 'https://heartlandaea.zoom.us/j/804914526' + '>https://heartlandaea.zoom.us/j/804914526</a> </p> + 
<p>If you are unable to attend virtually or in person, we will post videos of each presentation to '<a href=\"' + 'https://www.youtube.com/playlist?list=PLRAy7hvczWAXWKj4b6buttfLsGWLKGP8s' + '>Heartland’s YouTube Channel</a> a few days after this session. </p> + 
<p>Please pass this information on to all Social Studies teachers in your district or others in your building that might be interested in attending."</p>; 

var emailSent = row[7];  // Seventh column 
if (emailSent != EMAIL_SENT) { // Prevents sending duplicates 
    var subject = "Technology in Social Studies PD"; 
    MailApp.sendEmail(emailAddress, subject, message); 
    sheet.getRange(startRow + i, 8).setValue(EMAIL_SENT); 
    // Make sure the cell is updated right away in case the script is interrupted 
    SpreadsheetApp.flush(); 
} 
    } 
} 

Antwort

2

Zwei Dinge, die helfen könnten.

Da Sie HTML verwenden, verwenden Sie diese E-Mail senden:

MailApp.sendEmail(emailAddress, subject, "", {htmlBody: message}); 

Ist Nachricht richtig formatiert ist, scheint es „zu sein“ an Orten fehlt. versuchen Sie dies:

var message = "<p>Hi " + firstName + ",/n Are you looking for new ways to integrate technology into your lessons?" 
+ "Heartland AEA is offering a FREE professional development opportunity focused on integrating technology into Social Studies instruction. As part of our Technology Integration and Collaboration (TIC) series, this session will provide a free opportunity for educators from throughout Heartland's area to learn from exemplary teachers while collaborating with others who are passionate about education, technology, and social studies. We have a great lineup of presenters and would love to have as many educators as possible in attendance. If you are unable to attend in person, please consider participating through the livestream via Zoom.</p>" 
+ "<p>Whether you plan to attend in person or via Zoom, please '<a href=\"' + 'https://prodev.aeapdonline.org/4DCGI/TE099892111701INV&*' + '>register</a> in advance. More information about this and other upcoming TIC sessions can be found on the '<a href=\"' + 'https://sites.google.com/a/heartlandaea.org/heartland-tic/home' + '>TIC website</a>.</p>" 
+ "<p>Topic: 6-12 Social Studies: Quality Instruction Using Technology</p>" 
+ "<p>Date: January 12, 2017 </p>" 
+ "<p>Time: 8:30am - 11:30am </p>" 
+ "<p>Location: Johnston AEA</p>" 
+ "<p>To Register: '<a href=\"' + 'https://prodev.aeapdonline.org/4DCGI/TE099892111701INV&*' + '>Click Here</a>. It is FREE!</p>" 
+ "<p>Zoom Link: '<a href=\"' + 'https://heartlandaea.zoom.us/j/804914526' + '>https://heartlandaea.zoom.us/j/804914526</a> </p>" 
+ "<p>If you are unable to attend virtually or in person, we will post videos of each presentation to '<a href=\"' + 'https://www.youtube.com/playlist?list=PLRAy7hvczWAXWKj4b6buttfLsGWLKGP8s' + '>Heartland’s YouTube Channel</a> a few days after this session. </p>" 
+ "<p>Please pass this information on to all Social Studies teachers in your district or others in your building that might be interested in attending.</p>"; 
+0

Vielen Dank! Ich musste etwas mehr herumspielen, damit die Links in der Nachricht funktionieren, aber ich habe es verstanden. –