REST Resource: users.messages
Stay organized with collections
Save and categorize content based on your preferences.
Resource: Message
JSON representation
|
{
"id"
:
string
,
"threadId"
:
string
,
"labelIds"
:
[
string
]
,
"snippet"
:
string
,
"historyId"
:
string
,
"internalDate"
:
string
,
"payload"
:
{
object (
MessagePart
)
}
,
"sizeEstimate"
:
integer
,
"raw"
:
string
}
|
Fields
|
id
|
string
The immutable ID of the message.
|
threadId
|
string
The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met:
- The requested
threadId
must be specified on the
Message
or
Draft.Message
you supply with your request.
- The
References
and
In-Reply-To
headers must be set in compliance with the
RFC 2822
standard.
- The
Subject
headers must match.
|
labelIds[]
|
string
List of IDs of labels applied to this message.
|
snippet
|
string
A short part of the message text.
|
historyId
|
string
The ID of the last history record that modified this message.
|
internalDate
|
string (
int64
format)
The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the
Date
header. However, for API-migrated mail, it can be configured by client to be based on the
Date
header.
|
payload
|
object (
MessagePart
)
The parsed email structure in the message parts.
|
sizeEstimate
|
integer
Estimated size in bytes of the message.
|
raw
|
string (
bytes
format)
The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in
messages.get
and
drafts.get
responses when the
format=RAW
parameter is supplied.
A base64-encoded string.
|
MessagePart
A single MIME message part.
JSON representation
|
{
"partId"
:
string
,
"mimeType"
:
string
,
"filename"
:
string
,
"headers"
:
[
{
object (
Header
)
}
]
,
"body"
:
{
object (
MessagePartBody
)
}
,
"parts"
:
[
{
object (
MessagePart
)
}
]
}
|
Fields
|
partId
|
string
The immutable ID of the message part.
|
mimeType
|
string
The MIME type of the message part.
|
filename
|
string
The filename of the attachment. Only present if this message part represents an attachment.
|
body
|
object (
MessagePartBody
)
The message part body for this part, which may be empty for container MIME message parts.
|
parts[]
|
object (
MessagePart
)
The child MIME message parts of this part. This only applies to container MIME message parts, for example
multipart/*
. For non- container MIME message part types, such as
text/plain
, this field is empty. For more information, see
RFC 1521
.
|
Methods
|
|
Deletes many messages by message ID.
|
|
Modifies the labels on the specified messages.
|
|
Immediately and permanently deletes the specified message.
|
|
Gets the specified message.
|
|
Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP.
|
|
Directly inserts a message into only this user's mailbox similar to
IMAP APPEND
, bypassing most scanning and classification.
|
|
Lists the messages in the user's mailbox.
|
|
Modifies the labels on the specified message.
|
|
Sends the specified message to the recipients in the
To
,
Cc
, and
Bcc
headers.
|
|
Moves the specified message to the trash.
|
|
Removes the specified message from the trash.
|
Except as otherwise noted, the content of this page is licensed under the
Creative Commons Attribution 4.0 License
, and code samples are licensed under the
Apache 2.0 License
. For details, see the
Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-12-19 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]