A
A
ARSENIY_TR2021-07-16 12:14:54
Google Apps Script
ARSENIY_TR, 2021-07-16 12:14:54

How to send html email via script in tables?

There is already a script like this:

function sendSelectedEmails() {
    var sheet = SpreadsheetApp.getActiveSheet();
    var activeRange = sheet.getActiveRange();
    var data = activeRange.getValues();
    for (i in data) {
        var row = data[i];
        var emailAddress = row[0];
        var subject = row[1];
        var message = row[2];
        MailApp.sendEmail(emailAddress, subject, message);
    }
}


It is assigned to the button, the table is full. How could this script be modified to send emails as a converted html document?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2021-07-16
@ARSENIY_TR

Specify the htmlBodydesired HTML content of the email as a parameter.

MailApp.sendEmail(emailAddress, subject, message, {
  htmlBody: '<h1>Привет, Хабр!</h1>',
});

sendEmail() Documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question