Google Apps Script API
Preparing search index...
google-apps-script-events
GoogleAppsScript
Gmail
GmailApp
Interface GmailApp
Provides access to Gmail threads, messages, and labels.
interface
GmailApp
{
createDraft
(
recipient
:
string
,
subject
:
string
,
body
:
string
,
)
:
GmailDraft
;
createDraft
(
recipient
:
string
,
subject
:
string
,
body
:
string
,
options
:
GmailAdvancedOptions
,
)
:
GmailDraft
;
createLabel
(
name
:
string
)
:
GmailLabel
;
deleteLabel
(
label
:
GmailLabel
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
getAliases
()
:
string
[]
;
getChatThreads
()
:
GmailThread
[]
;
getChatThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
;
getDraft
(
draftId
:
string
)
:
GmailDraft
;
getDraftMessages
()
:
GmailMessage
[]
;
getDrafts
()
:
GmailDraft
[]
;
getInboxThreads
()
:
GmailThread
[]
;
getInboxThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
;
getInboxUnreadCount
()
:
number
;
getMessageById
(
id
:
string
)
:
GmailMessage
;
getMessagesForThread
(
thread
:
GmailThread
)
:
GmailMessage
[]
;
getMessagesForThreads
(
threads
:
GmailThread
[]
)
:
GmailMessage
[]
[]
;
getPriorityInboxThreads
()
:
GmailThread
[]
;
getPriorityInboxThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
;
getPriorityInboxUnreadCount
()
:
number
;
getSpamThreads
()
:
GmailThread
[]
;
getSpamThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
;
getSpamUnreadCount
()
:
number
;
getStarredThreads
()
:
GmailThread
[]
;
getStarredThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
;
getStarredUnreadCount
()
:
number
;
getThreadById
(
id
:
string
)
:
GmailThread
;
getTrashThreads
()
:
GmailThread
[]
;
getTrashThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
;
getUserLabelByName
(
name
:
string
)
:
GmailLabel
;
getUserLabels
()
:
GmailLabel
[]
;
markMessageRead
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
markMessagesRead
(
messages
:
GmailMessage
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
markMessagesUnread
(
messages
:
GmailMessage
[]
,
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
markMessageUnread
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
markThreadImportant
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
markThreadRead
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
markThreadsImportant
(
threads
:
GmailThread
[]
,
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
markThreadsRead
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
markThreadsUnimportant
(
threads
:
GmailThread
[]
,
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
markThreadsUnread
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
markThreadUnimportant
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
markThreadUnread
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
moveMessagesToTrash
(
messages
:
GmailMessage
[]
,
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
moveMessageToTrash
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
moveThreadsToArchive
(
threads
:
GmailThread
[]
,
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
moveThreadsToInbox
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
moveThreadsToSpam
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
moveThreadsToTrash
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
moveThreadToArchive
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
moveThreadToInbox
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
moveThreadToSpam
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
moveThreadToTrash
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
refreshMessage
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
refreshMessages
(
messages
:
GmailMessage
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
refreshThread
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
refreshThreads
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
search
(
query
:
string
)
:
GmailThread
[]
;
search
(
query
:
string
,
start
:
number
,
max
:
number
)
:
GmailThread
[]
;
sendEmail
(
recipient
:
string
,
subject
:
string
,
body
:
string
,
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
sendEmail
(
recipient
:
string
,
subject
:
string
,
body
:
string
,
options
:
GmailAdvancedOptions
,
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
setCurrentMessageAccessToken
(
accessToken
:
string
)
:
void
;
starMessage
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
starMessages
(
messages
:
GmailMessage
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
unstarMessage
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
unstarMessages
(
messages
:
GmailMessage
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
;
}
Index
Methods
create
Draft
create
Label
delete
Label
get
Aliases
get
Chat
Threads
get
Draft
get
Draft
Messages
get
Drafts
get
Inbox
Threads
get
Inbox
Unread
Count
get
Message
By
Id
get
Messages
For
Thread
get
Messages
For
Threads
get
Priority
Inbox
Threads
get
Priority
Inbox
Unread
Count
get
Spam
Threads
get
Spam
Unread
Count
get
Starred
Threads
get
Starred
Unread
Count
get
Thread
By
Id
get
Trash
Threads
get
User
Label
By
Name
get
User
Labels
mark
Message
Read
mark
Messages
Read
mark
Messages
Unread
mark
Message
Unread
mark
Thread
Important
mark
Thread
Read
mark
Threads
Important
mark
Threads
Read
mark
Threads
Unimportant
mark
Threads
Unread
mark
Thread
Unimportant
mark
Thread
Unread
move
Messages
To
Trash
move
Message
To
Trash
move
Threads
To
Archive
move
Threads
To
Inbox
move
Threads
To
Spam
move
Threads
To
Trash
move
Thread
To
Archive
move
Thread
To
Inbox
move
Thread
To
Spam
move
Thread
To
Trash
refresh
Message
refresh
Messages
refresh
Thread
refresh
Threads
search
send
Email
set
Current
Message
Access
Token
star
Message
star
Messages
unstar
Message
unstar
Messages
Methods
create
Draft
createDraft
(
recipient
:
string
,
subject
:
string
,
body
:
string
)
:
GmailDraft
Parameters
recipient
:
string
subject
:
string
body
:
string
Returns
GmailDraft
createDraft
(
recipient
:
string
,
subject
:
string
,
body
:
string
,
options
:
GmailAdvancedOptions
,
)
:
GmailDraft
Parameters
recipient
:
string
subject
:
string
body
:
string
options
:
GmailAdvancedOptions
Returns
GmailDraft
create
Label
createLabel
(
name
:
string
)
:
GmailLabel
Parameters
name
:
string
Returns
GmailLabel
delete
Label
deleteLabel
(
label
:
GmailLabel
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
label
:
GmailLabel
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
get
Aliases
getAliases
()
:
string
[]
Returns
string
[]
get
Chat
Threads
getChatThreads
()
:
GmailThread
[]
Returns
GmailThread
[]
getChatThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
Parameters
start
:
number
max
:
number
Returns
GmailThread
[]
get
Draft
getDraft
(
draftId
:
string
)
:
GmailDraft
Parameters
draftId
:
string
Returns
GmailDraft
get
Draft
Messages
getDraftMessages
()
:
GmailMessage
[]
Returns
GmailMessage
[]
get
Drafts
getDrafts
()
:
GmailDraft
[]
Returns
GmailDraft
[]
get
Inbox
Threads
getInboxThreads
()
:
GmailThread
[]
Returns
GmailThread
[]
getInboxThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
Parameters
start
:
number
max
:
number
Returns
GmailThread
[]
get
Inbox
Unread
Count
getInboxUnreadCount
()
:
number
Returns
number
get
Message
By
Id
getMessageById
(
id
:
string
)
:
GmailMessage
Parameters
id
:
string
Returns
GmailMessage
get
Messages
For
Thread
getMessagesForThread
(
thread
:
GmailThread
)
:
GmailMessage
[]
Parameters
thread
:
GmailThread
Returns
GmailMessage
[]
get
Messages
For
Threads
getMessagesForThreads
(
threads
:
GmailThread
[]
)
:
GmailMessage
[]
[]
Parameters
threads
:
GmailThread
[]
Returns
GmailMessage
[]
[]
get
Priority
Inbox
Threads
getPriorityInboxThreads
()
:
GmailThread
[]
Returns
GmailThread
[]
getPriorityInboxThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
Parameters
start
:
number
max
:
number
Returns
GmailThread
[]
get
Priority
Inbox
Unread
Count
getPriorityInboxUnreadCount
()
:
number
Returns
number
get
Spam
Threads
getSpamThreads
()
:
GmailThread
[]
Returns
GmailThread
[]
getSpamThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
Parameters
start
:
number
max
:
number
Returns
GmailThread
[]
get
Spam
Unread
Count
getSpamUnreadCount
()
:
number
Returns
number
get
Starred
Threads
getStarredThreads
()
:
GmailThread
[]
Returns
GmailThread
[]
getStarredThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
Parameters
start
:
number
max
:
number
Returns
GmailThread
[]
get
Starred
Unread
Count
getStarredUnreadCount
()
:
number
Returns
number
get
Thread
By
Id
getThreadById
(
id
:
string
)
:
GmailThread
Parameters
id
:
string
Returns
GmailThread
get
Trash
Threads
getTrashThreads
()
:
GmailThread
[]
Returns
GmailThread
[]
getTrashThreads
(
start
:
number
,
max
:
number
)
:
GmailThread
[]
Parameters
start
:
number
max
:
number
Returns
GmailThread
[]
get
User
Label
By
Name
getUserLabelByName
(
name
:
string
)
:
GmailLabel
Parameters
name
:
string
Returns
GmailLabel
get
User
Labels
getUserLabels
()
:
GmailLabel
[]
Returns
GmailLabel
[]
mark
Message
Read
markMessageRead
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
message
:
GmailMessage
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
mark
Messages
Read
markMessagesRead
(
messages
:
GmailMessage
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
messages
:
GmailMessage
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
mark
Messages
Unread
markMessagesUnread
(
messages
:
GmailMessage
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
messages
:
GmailMessage
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
mark
Message
Unread
markMessageUnread
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
message
:
GmailMessage
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
mark
Thread
Important
markThreadImportant
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
thread
:
GmailThread
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
mark
Thread
Read
markThreadRead
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
thread
:
GmailThread
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
mark
Threads
Important
markThreadsImportant
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
threads
:
GmailThread
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
mark
Threads
Read
markThreadsRead
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
threads
:
GmailThread
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
mark
Threads
Unimportant
markThreadsUnimportant
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
threads
:
GmailThread
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
mark
Threads
Unread
markThreadsUnread
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
threads
:
GmailThread
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
mark
Thread
Unimportant
markThreadUnimportant
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
thread
:
GmailThread
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
mark
Thread
Unread
markThreadUnread
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
thread
:
GmailThread
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
move
Messages
To
Trash
moveMessagesToTrash
(
messages
:
GmailMessage
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
messages
:
GmailMessage
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
move
Message
To
Trash
moveMessageToTrash
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
message
:
GmailMessage
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
move
Threads
To
Archive
moveThreadsToArchive
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
threads
:
GmailThread
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
move
Threads
To
Inbox
moveThreadsToInbox
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
threads
:
GmailThread
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
move
Threads
To
Spam
moveThreadsToSpam
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
threads
:
GmailThread
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
move
Threads
To
Trash
moveThreadsToTrash
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
threads
:
GmailThread
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
move
Thread
To
Archive
moveThreadToArchive
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
thread
:
GmailThread
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
move
Thread
To
Inbox
moveThreadToInbox
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
thread
:
GmailThread
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
move
Thread
To
Spam
moveThreadToSpam
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
thread
:
GmailThread
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
move
Thread
To
Trash
moveThreadToTrash
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
thread
:
GmailThread
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
refresh
Message
refreshMessage
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
message
:
GmailMessage
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
refresh
Messages
refreshMessages
(
messages
:
GmailMessage
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
messages
:
GmailMessage
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
refresh
Thread
refreshThread
(
thread
:
GmailThread
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
thread
:
GmailThread
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
refresh
Threads
refreshThreads
(
threads
:
GmailThread
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
threads
:
GmailThread
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
search
search
(
query
:
string
)
:
GmailThread
[]
Parameters
query
:
string
Returns
GmailThread
[]
search
(
query
:
string
,
start
:
number
,
max
:
number
)
:
GmailThread
[]
Parameters
query
:
string
start
:
number
max
:
number
Returns
GmailThread
[]
send
Email
sendEmail
(
recipient
:
string
,
subject
:
string
,
body
:
string
,
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
recipient
:
string
subject
:
string
body
:
string
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
sendEmail
(
recipient
:
string
,
subject
:
string
,
body
:
string
,
options
:
GmailAdvancedOptions
,
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
recipient
:
string
subject
:
string
body
:
string
options
:
GmailAdvancedOptions
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
set
Current
Message
Access
Token
setCurrentMessageAccessToken
(
accessToken
:
string
)
:
void
Parameters
accessToken
:
string
Returns
void
star
Message
starMessage
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
message
:
GmailMessage
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
star
Messages
starMessages
(
messages
:
GmailMessage
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
messages
:
GmailMessage
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
unstar
Message
unstarMessage
(
message
:
GmailMessage
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
message
:
GmailMessage
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
unstar
Messages
unstarMessages
(
messages
:
GmailMessage
[]
)
:
GoogleAppsScript
.
Gmail
.
GmailApp
Parameters
messages
:
GmailMessage
[]
Returns
GoogleAppsScript
.
Gmail
.
GmailApp
Settings
Member Visibility
Protected
Inherited
External
Theme
OS
Light
Dark
On This Page
Methods
create
Draft
create
Label
delete
Label
get
Aliases
get
Chat
Threads
get
Draft
get
Draft
Messages
get
Drafts
get
Inbox
Threads
get
Inbox
Unread
Count
get
Message
By
Id
get
Messages
For
Thread
get
Messages
For
Threads
get
Priority
Inbox
Threads
get
Priority
Inbox
Unread
Count
get
Spam
Threads
get
Spam
Unread
Count
get
Starred
Threads
get
Starred
Unread
Count
get
Thread
By
Id
get
Trash
Threads
get
User
Label
By
Name
get
User
Labels
mark
Message
Read
mark
Messages
Read
mark
Messages
Unread
mark
Message
Unread
mark
Thread
Important
mark
Thread
Read
mark
Threads
Important
mark
Threads
Read
mark
Threads
Unimportant
mark
Threads
Unread
mark
Thread
Unimportant
mark
Thread
Unread
move
Messages
To
Trash
move
Message
To
Trash
move
Threads
To
Archive
move
Threads
To
Inbox
move
Threads
To
Spam
move
Threads
To
Trash
move
Thread
To
Archive
move
Thread
To
Inbox
move
Thread
To
Spam
move
Thread
To
Trash
refresh
Message
refresh
Messages
refresh
Thread
refresh
Threads
search
send
Email
set
Current
Message
Access
Token
star
Message
star
Messages
unstar
Message
unstar
Messages
Google Apps Script API
Loading...
Provides access to Gmail threads, messages, and labels.