Gmail Service

Gmail

This Service lets you send email, compose drafts, manage labels, mark messages and threads, and conduct a variety of other Gmail account management tasks. See also Mail Service , a simpler service that only allows the sending of email.

Classes

Name Brief description
Gmail App Provides access to Gmail threads, messages, and labels.
Gmail Attachment An attachment from Gmail.
Gmail Draft A user-created draft message in a user's Gmail account.
Gmail Label A user-created label in a user's Gmail account.
Gmail Message A message in a user's Gmail account.
Gmail Thread A thread in a user's Gmail account.

Gmail App

Methods

Method Return type Brief description
Gmail Draft Creates a draft email message.
Gmail Draft Creates a draft email message with optional arguments.
Gmail Label Create a new user label of the given name.
Gmail App Deletes the specified label.
String[] Gets a list of the emails that are set up as aliases for this account in Gmail.
Gmail Draft Retrieve an email message draft by ID.
Gmail Message[] Retrieves all draft messages.
Gmail Draft[] Gets all Gmail draft messages.
Gmail Thread[] Retrieves all Inbox threads irrespective of labels.
Gmail Thread[] Retrieves a range of Inbox threads irrespective of labels.
Integer Gets the number of unread threads in the inbox.
Gmail Message Gets a message by ID.
Gmail Message[] Retrieve all messages in the specified thread.
Gmail Message[][] Retrieve all messages in the specified threads.
Gmail Thread[] Retrieves all Priority Inbox threads irrespective of labels.
Gmail Thread[] Retrieves a range of Priority Inbox threads irrespective of labels.
Integer Gets the number of unread threads in the Priority Inbox.
Gmail Thread[] Retrieves all spam threads irrespective of labels.
Gmail Thread[] Retrieves a range of spam threads irrespective of labels.
Integer Gets the number of unread threads that are spam.
Gmail Thread[] Retrieves all starred threads irrespective of labels.
Gmail Thread[] Retrieves a range of starred threads irrespective of labels.
Integer Gets the number of unread threads that are starred.
Gmail Thread Gets a thread by ID.
Gmail Thread[] Retrieves all trash threads irrespective of labels.
Gmail Thread[] Retrieves a range of trash threads irrespective of labels.
Gmail Label Retrieves a label given the label name.
Gmail Label[] Retrieves a list of user-created labels.
Gmail App Marks this message read and forces the message to refresh.
Gmail App Marks this message unread and forces the message to refresh.
Gmail App Marks these messages read and forces the messages to refresh.
Gmail App Marks these messages unread and forces the messages to refresh.
Gmail App Marks this thread as important and forces the thread to refresh.
Gmail App Marks this thread as read and forces the thread to refresh.
Gmail App Marks this thread as unimportant and forces the thread to refresh.
Gmail App Marks this thread unread and forces the thread to refresh.
Gmail App Marks these threads as important and forces the threads to refresh.
Gmail App Marks these threads as read and forces the threads to refresh.
Gmail App Marks these threads as unimportant and forces the threads to refresh.
Gmail App Marks these threads as unread and forces the threads to refresh.
Gmail App Moves the message to the trash and forces the message to refresh.
Gmail App Moves the specified messages to the trash and forces the messages to refresh.
Gmail App Moves this thread to the archive and forces the thread to refresh.
Gmail App Moves this thread to the inbox and forces the thread to refresh.
Gmail App Moves this thread to spam and forces the thread to refresh.
Gmail App Moves this thread to the trash and forces the thread to refresh.
Gmail App Moves these threads to the archive and forces the threads to refresh.
Gmail App Moves these threads to the inbox and forces the threads to refresh.
Gmail App Moves these threads to spam and forces the threads to refresh.
Gmail App Moves these threads to the trash and forces the threads to refresh.
Gmail App Reloads the message and associated state from Gmail (useful in case the labels, read state, etc., have changed).
Gmail App Reloads the messages and associated state from Gmail (useful in case the labels, read state, etc., have changed).
Gmail App Reloads the thread and associated state from Gmail (useful in case the labels, read state, etc., have changed).
Gmail App Reloads the threads and associated state from Gmail (useful in case the labels, read state, etc., have changed).
Gmail Thread[] Search Gmail with the given query.
Gmail Thread[] Search Gmail with the given query.
Gmail App Sends an email message.
Gmail App Sends an email message with optional arguments.
void Sets the current message access token that enables the script to access the current Gmail Message properties.
Gmail App Adds a star to this message and forces the message to refresh.
Gmail App Adds stars to these messages and forces the messages to refresh.
Gmail App Removes a star from this message and forces the message to refresh.
Gmail App Removes stars from these messages and forces the messages to refresh.

Gmail Attachment

Methods

Method Return type Brief description
Blob Returns a copy of this blob.
Blob Return the data inside this object as a blob converted to the specified content type.
Byte[] Gets the data stored in this blob.
String Gets the content type of the bytes in this blob.
String Gets the data of this blob as a String with UTF-8 encoding.
String Gets the data of this blob as a string with the specified encoding.
String Gets the SHA1 content hash for this attachment.
String Gets the name of this blob.
Integer Gets the size of this attachment.
Boolean Returns whether this blob is a Google Workspace file (Sheets, Docs, etc.).
Blob Sets the data stored in this blob.
Blob Sets the content type of the bytes in this blob.
Blob Sets the content type of the bytes in this blob based on the file extension.
Blob Sets the data of this blob from a string with UTF-8 encoding.
Blob Sets the data of this blob from a string with the specified encoding.
Blob Sets the name of this blob.

Gmail Draft

Methods

Method Return type Brief description
void Deletes this draft message.
String Gets the ID of this draft message.
Gmail Message Returns a GmailMessage representing this draft.
String Returns the ID of the Gmail Message representing this draft.
Gmail Message Sends this draft email message.
Gmail Draft Replaces the contents of this draft message.
Gmail Draft Replaces the contents of this draft message using optional arguments.

Gmail Label

Methods

Method Return type Brief description
Gmail Label Adds this label to the given thread and forces the thread to refresh ( Gmail Thread.refresh() ).
Gmail Label Adds this label to the given threads and forces the threads to refresh.
void Deletes this label.
String Gets the id of this label.
String Gets the name of this label.
Gmail Thread[] Gets the threads that are marked with this label.
Gmail Thread[] Gets a range of threads marked with this label.
Integer Gets the number of unread threads tagged with this label.
Gmail Label Removes this label from the given thread and forces the thread to refresh.
Gmail Label Removes this label from the given threads and forces the threads to refresh.

Gmail Message

Methods

Method Return type Brief description
Gmail Draft Creates a draft message replying to the sender of this message using the reply-to address.
Gmail Draft Creates a draft message replying to the sender of this message using the reply-to address, with optional arguments.
Gmail Draft Creates a draft message replying to the sender using the reply-to address and all recipients of this message.
Gmail Draft Creates a draft message replying to the sender of this message using the reply-to address and all recipients, with optional arguments.
Gmail Message Forwards this message to new recipients.
Gmail Message Forwards this message to new recipients, with optional arguments.
Gmail Attachment[] Gets all the attachments for this message.
Gmail Attachment[] Gets all the attachments for this message.
String Gets the comma-separated recipients bcc'd on this message.
String Gets the HTML content of the body of this message.
String Gets the comma-separated recipients cc'd on this message.
Date Gets the date and time of this message.
String Gets the sender of this message.
String Gets the value of an RFC 2822 header given the header name.
String Gets the ID of this message.
String Gets the content of the body of this message without HTML formatting.
String Gets the raw content of this message.
String Gets the reply-to address of this message (usually the sender).
String Gets the subject of this message.
Gmail Thread Gets the thread that contains this message.
String Gets the comma-separated recipients of this message.
Boolean Gets whether this message is a draft.
Boolean Gets whether this message is a chat.
Boolean Gets whether this message is in the inbox.
Boolean Returns true if this message is in the priority inbox; returns false otherwise.
Boolean Gets whether this message is in the trash.
Boolean Gets whether this message is starred.
Boolean Gets whether this message is unread.
Gmail Message Marks the message as read.
Gmail Message Marks the message as unread.
Gmail Message Moves the message to the trash.
Gmail Message Reloads this message and associated state from Gmail (useful in case the labels, read state, etc., have changed).
Gmail Message Replies to the sender of this message using the reply-to address.
Gmail Message Replies to the sender of this message using the reply-to address, with optional arguments.
Gmail Message Replies to the sender using the reply-to address and all recipients of this message.
Gmail Message Replies to the sender of this message using the reply-to address and all recipients, with optional arguments.
Gmail Message Stars the message.
Gmail Message Unstars the message.

Gmail Thread

Methods

Method Return type Brief description
Gmail Thread Adds this label to the thread.
Gmail Draft Creates a draft message replying to the sender of the last message in this thread using the reply-to address.
Gmail Draft Creates a draft message replying to the sender of the last message in this thread using the reply-to address, with optional arguments.
Gmail Draft Creates a draft message replying to the sender of the last message in this thread, using the reply-to address and all recipients of this message.
Gmail Draft Creates a draft message replying to the sender of the last message in this thread, using the reply-to address and all recipients, with optional arguments.
String Gets the subject of the first message in the thread.
String Gets the ID of this thread.
Gmail Label[] Returns the user-created labels on this thread.
Date Gets the date of this thread's most recent message.
Integer Returns the number of messages in the thread.
Gmail Message[] Gets the messages in this thread.
String Gets a permalink for this thread.
Boolean Returns whether the thread has any starred messages.
Boolean Returns whether the thread is marked as important.
Boolean Returns whether the thread is labeled a chat.
Boolean Returns whether the thread is in the inbox.
Boolean Returns true if this thread is in the priority inbox; returns false otherwise.
Boolean Returns whether the thread is marked as spam.
Boolean Returns whether the thread is in the trash.
Boolean Returns whether the thread has any unread messages.
Gmail Thread Marks this thread as important.
Gmail Thread Marks this thread as read.
Gmail Thread Marks this thread as unimportant.
Gmail Thread Marks this thread as unread.
Gmail Thread Moves this thread to the archive.
Gmail Thread Moves this thread to the inbox.
Gmail Thread Moves this thread to spam.
Gmail Thread Moves this thread to the trash.
Gmail Thread Reloads this thread, and associated state from Gmail (useful in case the labels, read state, etc., have changed).
Gmail Thread Removes this label from the thread.
Gmail Thread Reply to the sender of the last message on this thread using the replyTo address.
Gmail Thread Reply to the sender of the last message on this thread using the replyTo address, with optional arguments.
Gmail Thread Reply to the sender (using the replyTo address), and all recipients of the last message on this thread.
Gmail Thread Reply to the sender (using the reply To address), and all recipients of the last message on this thread, with optional arguments.
Create a Mobile Website
View Site in Mobile | Classic
Share by: