Is it possible to have HTML content in Gmail.Draft's update method?
In Gmail.Draft
's update method, having retrieved a Draft email, like:
var draft = GmaailApp.getDrafts()[0];
Updating works for plain text:
draft.update(recipients, subject, "New text for the draft");
But is it possible to replace the Body content with HTML content? (the Body parameter is String)
draft.update(recipients, subject, "<b>New text</b> for the draft"); // doesn't work
In order to set HTML body, you have to use the advanced parameter htmlBody
:
const options = {
htmlBody: "<b>New text</b> for the draft"
}
draft.update(recipients, subject, "", options)
If you provide that parameter, the body
parameter is ignored.