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](https://developers.google.com/apps-script/reference/mail), a simpler service
that only allows the sending of email.

## Classes

| Name | Brief description |
|---|---|
| `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Provides access to Gmail threads, messages, and labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment` | An attachment from Gmail. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | A user-created draft message in a user's Gmail account. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-label` | A user-created label in a user's Gmail account. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message` | A message in a user's Gmail account. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | A thread in a user's Gmail account. |

## `https://developers.google.com/apps-script/reference/gmail/gmail-app`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#createDraft(String,String,String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | Creates a draft email message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#createDraft(String,String,String,Object)` | `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | Creates a draft email message with optional arguments. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#createLabel(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-label` | Create a new user label of the given name. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#deleteLabel(GmailLabel)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Deletes the specified label. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getAliases()` | `String[]` | Gets a list of the emails that are set up as aliases for this account in Gmail. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getDraft(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | Retrieve an email message draft by ID. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getDraftMessages()` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Retrieves all draft messages. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getDrafts()` | `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | Gets all Gmail draft messages. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getInboxThreads()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Retrieves all Inbox threads irrespective of labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getInboxThreads(Integer,Integer)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Retrieves a range of Inbox threads irrespective of labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getInboxUnreadCount()` | `Integer` | Gets the number of unread threads in the inbox. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getMessageById(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Gets a message by ID. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getMessagesForThread(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Retrieve all messages in the specified thread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getMessagesForThreads(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Retrieve all messages in the specified threads. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getPriorityInboxThreads()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Retrieves all Priority Inbox threads irrespective of labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getPriorityInboxThreads(Integer,Integer)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Retrieves a range of Priority Inbox threads irrespective of labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getPriorityInboxUnreadCount()` | `Integer` | Gets the number of unread threads in the Priority Inbox. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getSpamThreads()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Retrieves all spam threads irrespective of labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getSpamThreads(Integer,Integer)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Retrieves a range of spam threads irrespective of labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getSpamUnreadCount()` | `Integer` | Gets the number of unread threads that are spam. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getStarredThreads()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Retrieves all starred threads irrespective of labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getStarredThreads(Integer,Integer)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Retrieves a range of starred threads irrespective of labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getStarredUnreadCount()` | `Integer` | Gets the number of unread threads that are starred. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getThreadById(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread|null` | Gets a thread by ID. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getTrashThreads()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Retrieves all trash threads irrespective of labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getTrashThreads(Integer,Integer)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Retrieves a range of trash threads irrespective of labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getUserLabelByName(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-label` | Retrieves a label given the label name. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#getUserLabels()` | `https://developers.google.com/apps-script/reference/gmail/gmail-label` | Retrieves a list of user-created labels. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markMessageRead(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks this message read and forces the message to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markMessageUnread(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks this message unread and forces the message to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markMessagesRead(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks these messages read and forces the messages to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markMessagesUnread(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks these messages unread and forces the messages to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markThreadImportant(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks this thread as important and forces the thread to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markThreadRead(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks this thread as read and forces the thread to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markThreadUnimportant(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks this thread as unimportant and forces the thread to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markThreadUnread(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks this thread unread and forces the thread to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markThreadsImportant(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks these threads as important and forces the threads to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markThreadsRead(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks these threads as read and forces the threads to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markThreadsUnimportant(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks these threads as unimportant and forces the threads to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#markThreadsUnread(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Marks these threads as unread and forces the threads to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#moveMessageToTrash(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Moves the message to the trash and forces the message to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#moveMessagesToTrash(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Moves the specified messages to the trash and forces the messages to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#moveThreadToArchive(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Moves this thread to the archive and forces the thread to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#moveThreadToInbox(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Moves this thread to the inbox and forces the thread to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#moveThreadToSpam(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Moves this thread to spam and forces the thread to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#moveThreadToTrash(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Moves this thread to the trash and forces the thread to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#moveThreadsToArchive(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Moves these threads to the archive and forces the threads to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#moveThreadsToInbox(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Moves these threads to the inbox and forces the threads to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#moveThreadsToSpam(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Moves these threads to spam and forces the threads to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#moveThreadsToTrash(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Moves these threads to the trash and forces the threads to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#refreshMessage(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Reloads the message and associated state from Gmail (useful in case the labels, read state, etc., have changed). |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#refreshMessages(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Reloads the messages and associated state from Gmail (useful in case the labels, read state, etc., have changed). |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#refreshThread(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Reloads the thread and associated state from Gmail (useful in case the labels, read state, etc., have changed). |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#refreshThreads(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Reloads the threads and associated state from Gmail (useful in case the labels, read state, etc., have changed). |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#search(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Search Gmail with the given query. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#search(String,Integer,Integer)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Search Gmail with the given query. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#sendEmail(String,String,String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Sends an email message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#sendEmail(String,String,String,Object)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Sends an email message with optional arguments. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#setCurrentMessageAccessToken(String)` | `void` | Sets the [current message access token](https://developers.google.com/workspace/add-ons/concepts/gsuite-scopes#access_tokens) that enables the script to access the current `https://developers.google.com/apps-script/reference/gmail/gmail-message` properties. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#starMessage(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Adds a star to this message and forces the message to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#starMessages(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Adds stars to these messages and forces the messages to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#unstarMessage(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Removes a star from this message and forces the message to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-app#unstarMessages(GmailMessage)` | `https://developers.google.com/apps-script/reference/gmail/gmail-app` | Removes stars from these messages and forces the messages to refresh. |

## `https://developers.google.com/apps-script/reference/gmail/gmail-attachment`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#copyBlob()` | `https://developers.google.com/apps-script/base/blob.html` | Returns a copy of this blob. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#getAs(String)` | `https://developers.google.com/apps-script/base/blob.html` | Return the data inside this object as a blob converted to the specified content type. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#getBytes()` | `Byte[]` | Gets the data stored in this blob. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#getContentType()` | `String|null` | Gets the content type of the bytes in this blob. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#getDataAsString()` | `String` | Gets the data of this blob as a String with UTF-8 encoding. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#getDataAsString(String)` | `String` | Gets the data of this blob as a string with the specified encoding. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#getHash()` | `String` | Gets the SHA1 content hash for this attachment. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#getName()` | `String|null` | Gets the name of this blob. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#getSize()` | `Integer` | Gets the size of this attachment. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#isGoogleType()` | `Boolean` | Returns whether this blob is a Google Workspace file (Sheets, Docs, etc.). |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#setBytes(Byte)` | `https://developers.google.com/apps-script/base/blob.html` | Sets the data stored in this blob. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#setContentType(String)` | `https://developers.google.com/apps-script/base/blob.html` | Sets the content type of the bytes in this blob. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#setContentTypeFromExtension()` | `https://developers.google.com/apps-script/base/blob.html` | Sets the content type of the bytes in this blob based on the file extension. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#setDataFromString(String)` | `https://developers.google.com/apps-script/base/blob.html` | Sets the data of this blob from a string with UTF-8 encoding. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#setDataFromString(String,String)` | `https://developers.google.com/apps-script/base/blob.html` | Sets the data of this blob from a string with the specified encoding. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-attachment#setName(String)` | `https://developers.google.com/apps-script/base/blob.html` | Sets the name of this blob. |

## `https://developers.google.com/apps-script/reference/gmail/gmail-draft`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/gmail/gmail-draft#deleteDraft()` | `void` | Deletes this draft message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-draft#getId()` | `String` | Gets the ID of this draft message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-draft#getMessage()` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Returns a GmailMessage representing this draft. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-draft#getMessageId()` | `String` | Returns the ID of the `https://developers.google.com/apps-script/reference/gmail/gmail-message` representing this draft. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-draft#send()` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Sends this draft email message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-draft#update(String,String,String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | Replaces the contents of this draft message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-draft#update(String,String,String,Object)` | `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | Replaces the contents of this draft message using optional arguments. |

## `https://developers.google.com/apps-script/reference/gmail/gmail-label`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/gmail/gmail-label#addToThread(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-label` | Adds this label to the given thread and forces the thread to refresh (`https://developers.google.com/apps-script/reference/gmail/gmail-thread#refresh()`). |
| `https://developers.google.com/apps-script/reference/gmail/gmail-label#addToThreads(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-label` | Adds this label to the given threads and forces the threads to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-label#deleteLabel()` | `void` | Deletes this label. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-label#getId()` | `String` | Gets the id of this label. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-label#getName()` | `String` | Gets the name of this label. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-label#getThreads()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Gets the threads that are marked with this label. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-label#getThreads(Integer,Integer)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Gets a range of threads marked with this label. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-label#getUnreadCount()` | `Integer` | Gets the number of unread threads tagged with this label. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-label#removeFromThread(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-label` | Removes this label from the given thread and forces the thread to refresh. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-label#removeFromThreads(GmailThread)` | `https://developers.google.com/apps-script/reference/gmail/gmail-label` | Removes this label from the given threads and forces the threads to refresh. |

## `https://developers.google.com/apps-script/reference/gmail/gmail-message`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#createDraftReply(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | Creates a draft message replying to the sender of this message using the reply-to address. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#createDraftReply(String,Object)` | `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | Creates a draft message replying to the sender of this message using the reply-to address, with optional arguments. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#createDraftReplyAll(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | Creates a draft message replying to the sender using the reply-to address and all recipients of this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#createDraftReplyAll(String,Object)` | `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | Creates a draft message replying to the sender of this message using the reply-to address and all recipients, with optional arguments. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#forward(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Forwards this message to new recipients. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#forward(String,Object)` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Forwards this message to new recipients, with optional arguments. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getAttachments()` | `https://developers.google.com/apps-script/reference/gmail/gmail-attachment` | Gets all the attachments for this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getAttachments(Object)` | `https://developers.google.com/apps-script/reference/gmail/gmail-attachment` | Gets all the attachments for this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getBcc()` | `String` | Gets the comma-separated recipients bcc'd on this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getBody()` | `String` | Gets the HTML content of the body of this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getCc()` | `String` | Gets the comma-separated recipients cc'd on this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getDate()` | `Date` | Gets the date and time of this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getFrom()` | `String` | Gets the sender of this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getHeader(String)` | `String` | Gets the value of an RFC 2822 header given the header name. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getId()` | `String` | Gets the ID of this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getPlainBody()` | `String` | Gets the content of the body of this message without HTML formatting. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getRawContent()` | `String` | Gets the raw content of this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getReplyTo()` | `String` | Gets the reply-to address of this message (usually the sender). |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getSubject()` | `String` | Gets the subject of this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getThread()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Gets the thread that contains this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#getTo()` | `String` | Gets the comma-separated recipients of this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#isDraft()` | `Boolean` | Gets whether this message is a draft. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#isInChats()` | `Boolean` | Gets whether this message is a chat. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#isInInbox()` | `Boolean` | Gets whether this message is in the inbox. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#isInPriorityInbox()` | `Boolean` | Returns `true` if this message is in the priority inbox; returns `false` otherwise. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#isInTrash()` | `Boolean` | Gets whether this message is in the trash. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#isStarred()` | `Boolean` | Gets whether this message is starred. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#isUnread()` | `Boolean` | Gets whether this message is unread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#markRead()` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Marks the message as read. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#markUnread()` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Marks the message as unread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#moveToTrash()` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Moves the message to the trash. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#refresh()` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Reloads this message and associated state from Gmail (useful in case the labels, read state, etc., have changed). |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#reply(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Replies to the sender of this message using the reply-to address. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#reply(String,Object)` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Replies to the sender of this message using the reply-to address, with optional arguments. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#replyAll(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Replies to the sender using the reply-to address and all recipients of this message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#replyAll(String,Object)` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Replies to the sender of this message using the reply-to address and all recipients, with optional arguments. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#star()` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Stars the message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-message#unstar()` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Unstars the message. |

## `https://developers.google.com/apps-script/reference/gmail/gmail-thread`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#addLabel(GmailLabel)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Adds this label to the thread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#createDraftReply(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-draft` | Creates a draft message replying to the sender of the last message in this thread using the reply-to address. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#createDraftReply(String,Object)` | `https://developers.google.com/apps-script/reference/gmail/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. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#createDraftReplyAll(String)` | `https://developers.google.com/apps-script/reference/gmail/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. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#createDraftReplyAll(String,Object)` | `https://developers.google.com/apps-script/reference/gmail/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. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#getFirstMessageSubject()` | `String` | Gets the subject of the first message in the thread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#getId()` | `String` | Gets the ID of this thread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#getLabels()` | `https://developers.google.com/apps-script/reference/gmail/gmail-label` | Returns the user-created labels on this thread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#getLastMessageDate()` | `Date` | Gets the date of this thread's most recent message. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#getMessageCount()` | `Integer` | Returns the number of messages in the thread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#getMessages()` | `https://developers.google.com/apps-script/reference/gmail/gmail-message` | Gets the messages in this thread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#getPermalink()` | `String` | Gets a permalink for this thread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#hasStarredMessages()` | `Boolean` | Returns whether the thread has any starred messages. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#isImportant()` | `Boolean` | Returns whether the thread is marked as important. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#isInChats()` | `Boolean` | Returns whether the thread is labeled a chat. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#isInInbox()` | `Boolean` | Returns whether the thread is in the inbox. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#isInPriorityInbox()` | `Boolean` | Returns true if this thread is in the priority inbox; returns false otherwise. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#isInSpam()` | `Boolean` | Returns whether the thread is marked as spam. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#isInTrash()` | `Boolean` | Returns whether the thread is in the trash. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#isUnread()` | `Boolean` | Returns whether the thread has any unread messages. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#markImportant()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Marks this thread as important. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#markRead()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Marks this thread as read. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#markUnimportant()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Marks this thread as unimportant. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#markUnread()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Marks this thread as unread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#moveToArchive()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Moves this thread to the archive. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#moveToInbox()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Moves this thread to the inbox. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#moveToSpam()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Moves this thread to spam. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#moveToTrash()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Moves this thread to the trash. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#refresh()` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Reloads this thread, and associated state from Gmail (useful in case the labels, read state, etc., have changed). |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#removeLabel(GmailLabel)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Removes this label from the thread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#reply(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Reply to the sender of the last message on this thread using the replyTo address. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#reply(String,Object)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Reply to the sender of the last message on this thread using the replyTo address, with optional arguments. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#replyAll(String)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Reply to the sender (using the replyTo address), and all recipients of the last message on this thread. |
| `https://developers.google.com/apps-script/reference/gmail/gmail-thread#replyAll(String,Object)` | `https://developers.google.com/apps-script/reference/gmail/gmail-thread` | Reply to the sender (using the `replyTo` address), and all recipients of the last message on this thread, with optional arguments. |