i am trying to send mails to some list of user using google apps-script.
I am taking the first draft mail and then mailing it to list of users present in the spreadsheet. But when i use ".getplainbody(); " function. It only copies the plain text in the draft.
function sendmail()
{
var drafts = GmailApp.getDraftMessages();
Logger.log(drafts.length);
var draft = drafts[0].getPlainBody();
Logger.log(draft);
GmailApp.sendEmail('[email protected]', 'subject', 'Hello' + '\n ' + draft);
}
I have also tried using the getbody() and then html with the message.
function sendmail()
{
var drafts = GmailApp.getDraftMessages();
Logger.log(drafts.length);
var draft = drafts[0].getBody();
Logger.log(draft);
GmailApp.sendEmail('[email protected]', 'subject', 'Hello' + '\n ' + {html: draft});
}
But this also gives me "[object Object]" in the inbox. Is there any other option to send the draft mail (not in plain text format)with proper format.
Thanks