我正在使用Google提供的示例应用程序脚本,该脚本使用列中的数据从电子表格发送电子邮件。它工作正常,只是该消息似乎在随机数个空格之后放回车符,换句话说,该消息没有填满整行,它在大约76个字符后中断。我包含了来自gmail和另一个邮件程序的电子邮件结果,因此您可以看到结果是相同的。我将消息放在一列中,并在此处硬编码为变量,结果是相同的。感谢任何帮助或想法,谢谢。
/**
* Sends emails with data from the current spreadsheet.
*/
function sendEmails() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // First row of data to process
var numRows = 2; // Number of rows to process
// Fetch the range of cells A2:B3
var dataRange = sheet.getRange(startRow, 1, numRows, 2);
// Fetch values for each row in the Range.
var data = dataRange.getValues();
for (i in data) {
var row = data[i];
var emailAddress = row[0]; // First column
//var message = row[3]; // Second column
var message = 'Unfortunately the XXXXX you inquired about was sold recently. However, we have an excellent selection of other similar vehicles at that price range and have new inventory coming in daily. Please try these tools to help you with your South Easton Motor Sales vehicle selection.';
var subject = 'Sending emails from a Spreadsheet';
MailApp.sendEmail(emailAddress, subject, message);
}
}