Gmail Service  |  Apps Script  |  Google for Developers (original) (raw)

Method

Return type

Brief description

[createDraft(recipient, subject, body)](/apps-script/reference/gmail/gmail-app#createDraft%28String,String,String%29)

[GmailDraft](/apps-script/reference/gmail/gmail-draft)

Creates a draft email message.

[createDraft(recipient, subject, body, options)](/apps-script/reference/gmail/gmail-app#createDraft%28String,String,String,Object%29)

[GmailDraft](/apps-script/reference/gmail/gmail-draft)

Creates a draft email message with optional arguments.

[createLabel(name)](/apps-script/reference/gmail/gmail-app#createLabel%28String%29)

[GmailLabel](/apps-script/reference/gmail/gmail-label)

Create a new user label of the given name.

[deleteLabel(label)](/apps-script/reference/gmail/gmail-app#deleteLabel%28GmailLabel%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Deletes the specified label.

[getAliases()](/apps-script/reference/gmail/gmail-app#getAliases%28%29)

String[]

Gets a list of the emails that are set up as aliases for this account in Gmail.

[getDraft(draftId)](/apps-script/reference/gmail/gmail-app#getDraft%28String%29)

[GmailDraft](/apps-script/reference/gmail/gmail-draft)

Retrieve an email message draft by ID.

[getDraftMessages()](/apps-script/reference/gmail/gmail-app#getDraftMessages%28%29)

[GmailMessage[]](/apps-script/reference/gmail/gmail-message)

Retrieves all draft messages.

[getDrafts()](/apps-script/reference/gmail/gmail-app#getDrafts%28%29)

[GmailDraft[]](/apps-script/reference/gmail/gmail-draft)

Gets all Gmail draft messages.

[getInboxThreads()](/apps-script/reference/gmail/gmail-app#getInboxThreads%28%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Retrieves all Inbox threads irrespective of labels.

[getInboxThreads(start, max)](/apps-script/reference/gmail/gmail-app#getInboxThreads%28Integer,Integer%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Retrieves a range of Inbox threads irrespective of labels.

[getInboxUnreadCount()](/apps-script/reference/gmail/gmail-app#getInboxUnreadCount%28%29)

Integer

Gets the number of unread threads in the inbox.

[getMessageById(id)](/apps-script/reference/gmail/gmail-app#getMessageById%28String%29)

[GmailMessage](/apps-script/reference/gmail/gmail-message)

Gets a message by ID.

[getMessagesForThread(thread)](/apps-script/reference/gmail/gmail-app#getMessagesForThread%28GmailThread%29)

[GmailMessage[]](/apps-script/reference/gmail/gmail-message)

Retrieve all messages in the specified thread.

[getMessagesForThreads(threads)](/apps-script/reference/gmail/gmail-app#getMessagesForThreads%28GmailThread%29)

[GmailMessage[][]](/apps-script/reference/gmail/gmail-message)

Retrieve all messages in the specified threads.

[getPriorityInboxThreads()](/apps-script/reference/gmail/gmail-app#getPriorityInboxThreads%28%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Retrieves all Priority Inbox threads irrespective of labels.

[getPriorityInboxThreads(start, max)](/apps-script/reference/gmail/gmail-app#getPriorityInboxThreads%28Integer,Integer%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Retrieves a range of Priority Inbox threads irrespective of labels.

[getPriorityInboxUnreadCount()](/apps-script/reference/gmail/gmail-app#getPriorityInboxUnreadCount%28%29)

Integer

Gets the number of unread threads in the Priority Inbox.

[getSpamThreads()](/apps-script/reference/gmail/gmail-app#getSpamThreads%28%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Retrieves all spam threads irrespective of labels.

[getSpamThreads(start, max)](/apps-script/reference/gmail/gmail-app#getSpamThreads%28Integer,Integer%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Retrieves a range of spam threads irrespective of labels.

[getSpamUnreadCount()](/apps-script/reference/gmail/gmail-app#getSpamUnreadCount%28%29)

Integer

Gets the number of unread threads that are spam.

[getStarredThreads()](/apps-script/reference/gmail/gmail-app#getStarredThreads%28%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Retrieves all starred threads irrespective of labels.

[getStarredThreads(start, max)](/apps-script/reference/gmail/gmail-app#getStarredThreads%28Integer,Integer%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Retrieves a range of starred threads irrespective of labels.

[getStarredUnreadCount()](/apps-script/reference/gmail/gmail-app#getStarredUnreadCount%28%29)

Integer

Gets the number of unread threads that are starred.

[getThreadById(id)](/apps-script/reference/gmail/gmail-app#getThreadById%28String%29)

[GmailThread](/apps-script/reference/gmail/gmail-thread)

Gets a thread by ID.

[getTrashThreads()](/apps-script/reference/gmail/gmail-app#getTrashThreads%28%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Retrieves all trash threads irrespective of labels.

[getTrashThreads(start, max)](/apps-script/reference/gmail/gmail-app#getTrashThreads%28Integer,Integer%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Retrieves a range of trash threads irrespective of labels.

[getUserLabelByName(name)](/apps-script/reference/gmail/gmail-app#getUserLabelByName%28String%29)

[GmailLabel](/apps-script/reference/gmail/gmail-label)

Retrieves a label given the label name.

[getUserLabels()](/apps-script/reference/gmail/gmail-app#getUserLabels%28%29)

[GmailLabel[]](/apps-script/reference/gmail/gmail-label)

Retrieves a list of user-created labels.

[markMessageRead(message)](/apps-script/reference/gmail/gmail-app#markMessageRead%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks this message read and forces the message to refresh.

[markMessageUnread(message)](/apps-script/reference/gmail/gmail-app#markMessageUnread%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks this message unread and forces the message to refresh.

[markMessagesRead(messages)](/apps-script/reference/gmail/gmail-app#markMessagesRead%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks these messages read and forces the messages to refresh.

[markMessagesUnread(messages)](/apps-script/reference/gmail/gmail-app#markMessagesUnread%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks these messages unread and forces the messages to refresh.

[markThreadImportant(thread)](/apps-script/reference/gmail/gmail-app#markThreadImportant%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks this thread as important and forces the thread to refresh.

[markThreadRead(thread)](/apps-script/reference/gmail/gmail-app#markThreadRead%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks this thread as read and forces the thread to refresh.

[markThreadUnimportant(thread)](/apps-script/reference/gmail/gmail-app#markThreadUnimportant%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks this thread as unimportant and forces the thread to refresh.

[markThreadUnread(thread)](/apps-script/reference/gmail/gmail-app#markThreadUnread%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks this thread unread and forces the thread to refresh.

[markThreadsImportant(threads)](/apps-script/reference/gmail/gmail-app#markThreadsImportant%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks these threads as important and forces the threads to refresh.

[markThreadsRead(threads)](/apps-script/reference/gmail/gmail-app#markThreadsRead%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks these threads as read and forces the threads to refresh.

[markThreadsUnimportant(threads)](/apps-script/reference/gmail/gmail-app#markThreadsUnimportant%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks these threads as unimportant and forces the threads to refresh.

[markThreadsUnread(threads)](/apps-script/reference/gmail/gmail-app#markThreadsUnread%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Marks these threads as unread and forces the threads to refresh.

[moveMessageToTrash(message)](/apps-script/reference/gmail/gmail-app#moveMessageToTrash%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Moves the message to the trash and forces the message to refresh.

[moveMessagesToTrash(messages)](/apps-script/reference/gmail/gmail-app#moveMessagesToTrash%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Moves the specified messages to the trash and forces the messages to refresh.

[moveThreadToArchive(thread)](/apps-script/reference/gmail/gmail-app#moveThreadToArchive%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Moves this thread to the archive and forces the thread to refresh.

[moveThreadToInbox(thread)](/apps-script/reference/gmail/gmail-app#moveThreadToInbox%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Moves this thread to the inbox and forces the thread to refresh.

[moveThreadToSpam(thread)](/apps-script/reference/gmail/gmail-app#moveThreadToSpam%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Moves this thread to spam and forces the thread to refresh.

[moveThreadToTrash(thread)](/apps-script/reference/gmail/gmail-app#moveThreadToTrash%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Moves this thread to the trash and forces the thread to refresh.

[moveThreadsToArchive(threads)](/apps-script/reference/gmail/gmail-app#moveThreadsToArchive%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Moves these threads to the archive and forces the threads to refresh.

[moveThreadsToInbox(threads)](/apps-script/reference/gmail/gmail-app#moveThreadsToInbox%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Moves these threads to the inbox and forces the threads to refresh.

[moveThreadsToSpam(threads)](/apps-script/reference/gmail/gmail-app#moveThreadsToSpam%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Moves these threads to spam and forces the threads to refresh.

[moveThreadsToTrash(threads)](/apps-script/reference/gmail/gmail-app#moveThreadsToTrash%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Moves these threads to the trash and forces the threads to refresh.

[refreshMessage(message)](/apps-script/reference/gmail/gmail-app#refreshMessage%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Reloads the message and associated state from Gmail (useful in case the labels, read state, etc., have changed).

[refreshMessages(messages)](/apps-script/reference/gmail/gmail-app#refreshMessages%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Reloads the messages and associated state from Gmail (useful in case the labels, read state, etc., have changed).

[refreshThread(thread)](/apps-script/reference/gmail/gmail-app#refreshThread%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Reloads the thread and associated state from Gmail (useful in case the labels, read state, etc., have changed).

[refreshThreads(threads)](/apps-script/reference/gmail/gmail-app#refreshThreads%28GmailThread%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Reloads the threads and associated state from Gmail (useful in case the labels, read state, etc., have changed).

[search(query)](/apps-script/reference/gmail/gmail-app#search%28String%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Search Gmail with the given query.

[search(query, start, max)](/apps-script/reference/gmail/gmail-app#search%28String,Integer,Integer%29)

[GmailThread[]](/apps-script/reference/gmail/gmail-thread)

Search Gmail with the given query.

[sendEmail(recipient, subject, body)](/apps-script/reference/gmail/gmail-app#sendEmail%28String,String,String%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Sends an email message.

[sendEmail(recipient, subject, body, options)](/apps-script/reference/gmail/gmail-app#sendEmail%28String,String,String,Object%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Sends an email message with optional arguments.

[setCurrentMessageAccessToken(accessToken)](/apps-script/reference/gmail/gmail-app#setCurrentMessageAccessToken%28String%29)

void

Sets the current message access token that enables the script to access the current [GmailMessage](/apps-script/reference/gmail/gmail-message) properties.

[starMessage(message)](/apps-script/reference/gmail/gmail-app#starMessage%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Adds a star to this message and forces the message to refresh.

[starMessages(messages)](/apps-script/reference/gmail/gmail-app#starMessages%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Adds stars to these messages and forces the messages to refresh.

[unstarMessage(message)](/apps-script/reference/gmail/gmail-app#unstarMessage%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Removes a star from this message and forces the message to refresh.

[unstarMessages(messages)](/apps-script/reference/gmail/gmail-app#unstarMessages%28GmailMessage%29)

[GmailApp](/apps-script/reference/gmail/gmail-app)

Removes stars from these messages and forces the messages to refresh.