Drafts Reference

GmailMessage

The GmailMessage object can be used to create and send mail messages through Gmail accounts, similar to those created by a Gmail action step. Creating and sending these messages happens in the background, with no user interface, so messages must be complete with recipients before calling send(). Sending is done via the Gmail API. Gmail accounts are authenticated when used for the first time using OAuth - to use more than one account, call create with different identifier parameters.

Instance Properties

Functions

Class Functions

Examples

let message = GmailMessage.create();
message.toRecipients = ["joe@sample.com"];
message.subject = "My test message";
message.body = "Body text";

var success = message.send();
if (!success) {
  console.log("Sending gmail failed");
  context.fail();
}