Skip to main content

messages

Overview

Namemessages
TypeResource
Idgoogleworkspace.gmail.messages

Fields

NameDatatypeDescription
idstringThe immutable ID of the message.
snippetstringA short part of the message text.
payloadobjectA single MIME message part.
historyIdstringThe ID of the last history record that modified this message.
labelIdsarrayList of IDs of labels applied to this message.
sizeEstimateintegerEstimated size in bytes of the message.
threadIdstringThe ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested threadId must be specified on the Message or Draft.Message you supply with your request. 2. The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. 3. The Subject headers must match.
rawstringThe 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.
internalDatestringThe 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.

Methods

NameAccessible byRequired ParamsDescription
users_messages_getSELECTid, userIdGets the specified message.
users_messages_listSELECTuserIdLists the messages in the user's mailbox.
users_messages_deleteDELETEid, userIdImmediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.
users_messages_batchDeleteEXECuserIdDeletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all.
users_messages_batchModifyEXECuserIdModifies the labels on the specified messages.
users_messages_importEXECuserIdImports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. This method doesn't perform SPF checks, so it might not work for some spam messages, such as those attempting to perform domain spoofing. This method does not send a message. Note: This function doesn't trigger forwarding rules or filters set up by the user.
users_messages_insertEXECuserIdDirectly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.
users_messages_modifyEXECid, userIdModifies the labels on the specified message.
users_messages_sendEXECuserIdSends the specified message to the recipients in the To, Cc, and Bcc headers.
users_messages_trashEXECid, userIdMoves the specified message to the trash.
users_messages_untrashEXECid, userIdRemoves the specified message from the trash.