class UsersMessages extends Resource (View source)

The "messages" collection of methods.

Typical usage is:

 $gmailService = new Google\Service\Gmail(...);
 $messages = $gmailService->users_messages;

Methods

batchDelete(string $userId, BatchDeleteMessagesRequest $postBody, array $optParams = [])

Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all. (messages.batchDelete)

batchModify(string $userId, BatchModifyMessagesRequest $postBody, array $optParams = [])

Modifies the labels on the specified messages. (messages.batchModify)

delete(string $userId, string $id, array $optParams = [])

Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead. (messages.delete)

get(string $userId, string $id, array $optParams = [])

Gets the specified message. (messages.get)

import(string $userId, Message $postBody, array $optParams = [])

Imports 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. (messages.import)

insert(string $userId, Message $postBody, array $optParams = [])

Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.

listUsersMessages(string $userId, array $optParams = [])

Lists the messages in the user's mailbox. (messages.listUsersMessages)

modify(string $userId, string $id, ModifyMessageRequest $postBody, array $optParams = [])

Modifies the labels on the specified message. (messages.modify)

send(string $userId, Message $postBody, array $optParams = [])

Sends the specified message to the recipients in the To, Cc, and Bcc headers. For example usage, see Sending email.

trash(string $userId, string $id, array $optParams = [])

Moves the specified message to the trash. (messages.trash)

untrash(string $userId, string $id, array $optParams = [])

Removes the specified message from the trash. (messages.untrash)

Details

batchDelete(string $userId, BatchDeleteMessagesRequest $postBody, array $optParams = [])

Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all. (messages.batchDelete)

Parameters

string $userId

The user's email address. The special value me can be used to indicate the authenticated user.

BatchDeleteMessagesRequest $postBody
array $optParams

Optional parameters.

Exceptions

Exception

batchModify(string $userId, BatchModifyMessagesRequest $postBody, array $optParams = [])

Modifies the labels on the specified messages. (messages.batchModify)

Parameters

string $userId

The user's email address. The special value me can be used to indicate the authenticated user.

BatchModifyMessagesRequest $postBody
array $optParams

Optional parameters.

Exceptions

Exception

delete(string $userId, string $id, array $optParams = [])

Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead. (messages.delete)

Parameters

string $userId

The user's email address. The special value me can be used to indicate the authenticated user.

string $id

The ID of the message to delete.

array $optParams

Optional parameters.

Exceptions

Exception

Message get(string $userId, string $id, array $optParams = [])

Gets the specified message. (messages.get)

Parameters

string $userId

The user's email address. The special value me can be used to indicate the authenticated user.

string $id

The ID of the message to retrieve. This ID is usually retrieved using messages.list. The ID is also contained in the result when a message is inserted (messages.insert) or imported (messages.import).

array $optParams

Optional parameters.

Return Value

Message

Exceptions

Exception

Message import(string $userId, Message $postBody, array $optParams = [])

Imports 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. (messages.import)

Parameters

string $userId

The user's email address. The special value me can be used to indicate the authenticated user.

Message $postBody
array $optParams

Optional parameters.

Return Value

Message

Exceptions

Exception

Message insert(string $userId, Message $postBody, array $optParams = [])

Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.

(messages.insert)

Parameters

string $userId

The user's email address. The special value me can be used to indicate the authenticated user.

Message $postBody
array $optParams

Optional parameters.

Return Value

Message

Exceptions

Exception

ListMessagesResponse listUsersMessages(string $userId, array $optParams = [])

Lists the messages in the user's mailbox. (messages.listUsersMessages)

Parameters

string $userId

The user's email address. The special value me can be used to indicate the authenticated user.

array $optParams

Optional parameters.

Return Value

ListMessagesResponse

Exceptions

Exception

Message modify(string $userId, string $id, ModifyMessageRequest $postBody, array $optParams = [])

Modifies the labels on the specified message. (messages.modify)

Parameters

string $userId

The user's email address. The special value me can be used to indicate the authenticated user.

string $id

The ID of the message to modify.

ModifyMessageRequest $postBody
array $optParams

Optional parameters.

Return Value

Message

Exceptions

Exception

Message send(string $userId, Message $postBody, array $optParams = [])

Sends the specified message to the recipients in the To, Cc, and Bcc headers. For example usage, see Sending email.

(messages.send)

Parameters

string $userId

The user's email address. The special value me can be used to indicate the authenticated user.

Message $postBody
array $optParams

Optional parameters.

Return Value

Message

Exceptions

Exception

Message trash(string $userId, string $id, array $optParams = [])

Moves the specified message to the trash. (messages.trash)

Parameters

string $userId

The user's email address. The special value me can be used to indicate the authenticated user.

string $id

The ID of the message to Trash.

array $optParams

Optional parameters.

Return Value

Message

Exceptions

Exception

Message untrash(string $userId, string $id, array $optParams = [])

Removes the specified message from the trash. (messages.untrash)

Parameters

string $userId

The user's email address. The special value me can be used to indicate the authenticated user.

string $id

The ID of the message to remove from Trash.

array $optParams

Optional parameters.

Return Value

Message

Exceptions

Exception