Скрипты Google App, добавляющие разрыв в тело письма - PullRequest
0 голосов
/ 08 декабря 2018

Мой скрипт приложения Google произвольно добавляет разрывы строк.Как я могу расширить сообщение, чтобы оно не было разрывов строк.В браузере на ПК это выглядит сносно, а на телефоне - еще хуже.

ПРИМЕЧАНИЕ. Это не проблема перевода строки.Он ставит перерывы в местах, где нет новой строки (\ n \ n).

function sendEmails2() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var startRow = 2;  // First row of data to process
  var numRows = 1000;   // Number of rows to process
  // Fetch the range of cells 
  var dataRange = sheet.getRange(startRow, 1, numRows, 1000)
  // 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 name = "Sacred";
    var subject = row[2] + " Pre-Registration: " + row[1];
    var cc = "info@something.com";
    var emailAddress = row[3];  // Fourth column
    var message = "\nHello \n\nDear " + row[1] + ", \n\nThank you for pre-registering with us. \n\nIf you registered for 2019, please find the package details here: https://www.exampleform.com \n\nPlease review the package and fill out the form. We will review your application and advise if we have space to accommodate you this year. \n\nIf you registered for 2020, we will reach out to you at the end of 2019 with the relevant details. \n\nIn the meanwhile, if you have any urgent questions, please do use the Contact page on something.com. Please note that pre-registration does not guarantee a spot with us. We have very limited seats. \nThank you,\nThe Sacred Team";// Second column
    var emailSent = row[24];     // 24th column


    if (emailSent != EMAIL_SENT && emailAddress != "") {  // Prevents sending duplicates
      MailApp.sendEmail(emailAddress, subject, message, {name: name, cc: cc});
      sheet.getRange(startRow + i, 25).setValue(EMAIL_SENT);
      // Make sure the cell is updated right away in case the script is interrupted
      SpreadsheetApp.flush();  

    }
  }
}

Кроме того, кто-нибудь знает, как я могу выделить некоторые части сообщения?

...