Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 1 | <html><body> |
| 2 | <style> |
| 3 | |
| 4 | body, h1, h2, h3, div, span, p, pre, a { |
| 5 | margin: 0; |
| 6 | padding: 0; |
| 7 | border: 0; |
| 8 | font-weight: inherit; |
| 9 | font-style: inherit; |
| 10 | font-size: 100%; |
| 11 | font-family: inherit; |
| 12 | vertical-align: baseline; |
| 13 | } |
| 14 | |
| 15 | body { |
| 16 | font-size: 13px; |
| 17 | padding: 1em; |
| 18 | } |
| 19 | |
| 20 | h1 { |
| 21 | font-size: 26px; |
| 22 | margin-bottom: 1em; |
| 23 | } |
| 24 | |
| 25 | h2 { |
| 26 | font-size: 24px; |
| 27 | margin-bottom: 1em; |
| 28 | } |
| 29 | |
| 30 | h3 { |
| 31 | font-size: 20px; |
| 32 | margin-bottom: 1em; |
| 33 | margin-top: 1em; |
| 34 | } |
| 35 | |
| 36 | pre, code { |
| 37 | line-height: 1.5; |
| 38 | font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; |
| 39 | } |
| 40 | |
| 41 | pre { |
| 42 | margin-top: 0.5em; |
| 43 | } |
| 44 | |
| 45 | h1, h2, h3, p { |
| 46 | font-family: Arial, sans serif; |
| 47 | } |
| 48 | |
| 49 | h1, h2, h3 { |
| 50 | border-bottom: solid #CCC 1px; |
| 51 | } |
| 52 | |
| 53 | .toc_element { |
| 54 | margin-top: 0.5em; |
| 55 | } |
| 56 | |
| 57 | .firstline { |
| 58 | margin-left: 2 em; |
| 59 | } |
| 60 | |
| 61 | .method { |
| 62 | margin-top: 1em; |
| 63 | border: solid 1px #CCC; |
| 64 | padding: 1em; |
| 65 | background: #EEE; |
| 66 | } |
| 67 | |
| 68 | .details { |
| 69 | font-weight: bold; |
| 70 | font-size: 14px; |
| 71 | } |
| 72 | |
| 73 | </style> |
| 74 | |
| 75 | <h1><a href="gmail_v1.html">Gmail API</a> . <a href="gmail_v1.users.html">users</a> . <a href="gmail_v1.users.messages.html">messages</a></h1> |
| 76 | <h2>Instance Methods</h2> |
| 77 | <p class="toc_element"> |
| 78 | <code><a href="gmail_v1.users.messages.attachments.html">attachments()</a></code> |
| 79 | </p> |
| 80 | <p class="firstline">Returns the attachments Resource.</p> |
| 81 | |
| 82 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 83 | <code><a href="#batchDelete">batchDelete(userId, body=None)</a></code></p> |
| 84 | <p class="firstline">Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all.</p> |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 85 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 86 | <code><a href="#batchModify">batchModify(userId, body=None)</a></code></p> |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 87 | <p class="firstline">Modifies the labels on the specified messages.</p> |
| 88 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 89 | <code><a href="#delete">delete(userId, id)</a></code></p> |
| 90 | <p class="firstline">Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.</p> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 91 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 92 | <code><a href="#get">get(userId, id, format=None, metadataHeaders=None)</a></code></p> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 93 | <p class="firstline">Gets the specified message.</p> |
| 94 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 95 | <code><a href="#import_">import_(userId, body=None, deleted=None, internalDateSource=None, neverMarkSpam=None, processForCalendar=None, media_body=None, media_mime_type=None)</a></code></p> |
| 96 | <p class="firstline">Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. Does not send a message.</p> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 97 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 98 | <code><a href="#insert">insert(userId, body=None, deleted=None, internalDateSource=None, media_body=None, media_mime_type=None)</a></code></p> |
| 99 | <p class="firstline">Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.</p> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 100 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 101 | <code><a href="#list">list(userId, includeSpamTrash=None, labelIds=None, maxResults=None, pageToken=None, q=None)</a></code></p> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 102 | <p class="firstline">Lists the messages in the user's mailbox.</p> |
| 103 | <p class="toc_element"> |
| 104 | <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> |
| 105 | <p class="firstline">Retrieves the next page of results.</p> |
| 106 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 107 | <code><a href="#modify">modify(userId, id, body=None)</a></code></p> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 108 | <p class="firstline">Modifies the labels on the specified message.</p> |
| 109 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 110 | <code><a href="#send">send(userId, body=None, media_body=None, media_mime_type=None)</a></code></p> |
| 111 | <p class="firstline">Sends the specified message to the recipients in the To, Cc, and Bcc headers.</p> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 112 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 113 | <code><a href="#trash">trash(userId, id)</a></code></p> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 114 | <p class="firstline">Moves the specified message to the trash.</p> |
| 115 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 116 | <code><a href="#untrash">untrash(userId, id)</a></code></p> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 117 | <p class="firstline">Removes the specified message from the trash.</p> |
| 118 | <h3>Method Details</h3> |
| 119 | <div class="method"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 120 | <code class="details" id="batchDelete">batchDelete(userId, body=None)</code> |
| 121 | <pre>Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all. |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 122 | |
| 123 | Args: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 124 | userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 125 | body: object, The request body. |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 126 | The object takes the form of: |
| 127 | |
| 128 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 129 | "ids": [ # The IDs of the messages to delete. |
| 130 | "A String", |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 131 | ], |
| 132 | } |
| 133 | |
| 134 | </pre> |
| 135 | </div> |
| 136 | |
| 137 | <div class="method"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 138 | <code class="details" id="batchModify">batchModify(userId, body=None)</code> |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 139 | <pre>Modifies the labels on the specified messages. |
| 140 | |
| 141 | Args: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 142 | userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 143 | body: object, The request body. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 144 | The object takes the form of: |
| 145 | |
| 146 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 147 | "addLabelIds": [ # A list of label IDs to add to messages. |
| 148 | "A String", |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 149 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 150 | "ids": [ # The IDs of the messages to modify. There is a limit of 1000 ids per request. |
| 151 | "A String", |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 152 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 153 | "removeLabelIds": [ # A list of label IDs to remove from messages. |
| 154 | "A String", |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 155 | ], |
| 156 | } |
| 157 | |
| 158 | </pre> |
| 159 | </div> |
| 160 | |
| 161 | <div class="method"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 162 | <code class="details" id="delete">delete(userId, id)</code> |
| 163 | <pre>Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 164 | |
| 165 | Args: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 166 | userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 167 | id: string, The ID of the message to delete. (required) |
| 168 | </pre> |
| 169 | </div> |
| 170 | |
| 171 | <div class="method"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 172 | <code class="details" id="get">get(userId, id, format=None, metadataHeaders=None)</code> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 173 | <pre>Gets the specified message. |
| 174 | |
| 175 | Args: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 176 | userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 177 | id: string, The ID of the message to retrieve. (required) |
| 178 | format: string, The format to return the message in. |
| 179 | Allowed values |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 180 | full - |
| 181 | metadata - |
| 182 | minimal - |
| 183 | raw - |
Craig Citro | 0e5b9bf | 2014-10-15 10:26:14 -0700 | [diff] [blame] | 184 | metadataHeaders: string, When given and format is METADATA, only include headers specified. (repeated) |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 185 | |
| 186 | Returns: |
| 187 | An object of the form: |
| 188 | |
| 189 | { # An email message. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 190 | "historyId": "A String", # The ID of the last history record that modified this message. |
| 191 | "id": "A String", # The immutable ID of the message. |
| 192 | "internalDate": "A String", # 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. |
| 193 | "labelIds": [ # List of IDs of labels applied to this message. |
| 194 | "A String", |
| 195 | ], |
| 196 | "payload": { # A single MIME message part. # The parsed email structure in the message parts. |
| 197 | "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. |
| 198 | "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. |
| 199 | "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. |
| 200 | "size": 42, # Number of bytes for the message part data (encoding notwithstanding). |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 201 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 202 | "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. |
| 203 | "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 204 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 205 | "name": "A String", # The name of the header before the : separator. For example, To. |
| 206 | "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 207 | }, |
| 208 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 209 | "mimeType": "A String", # The MIME type of the message part. |
| 210 | "partId": "A String", # The immutable ID of the message part. |
| 211 | "parts": [ # 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. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 212 | # Object with schema name: MessagePart |
| 213 | ], |
| 214 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 215 | "raw": "A String", # 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. |
| 216 | "sizeEstimate": 42, # Estimated size in bytes of the message. |
| 217 | "snippet": "A String", # A short part of the message text. |
| 218 | "threadId": "A 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: |
| 219 | # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. |
| 220 | # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. |
| 221 | # - The Subject headers must match. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 222 | }</pre> |
| 223 | </div> |
| 224 | |
| 225 | <div class="method"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 226 | <code class="details" id="import_">import_(userId, body=None, deleted=None, internalDateSource=None, neverMarkSpam=None, processForCalendar=None, media_body=None, media_mime_type=None)</code> |
| 227 | <pre>Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. Does not send a message. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 228 | |
| 229 | Args: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 230 | userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 231 | body: object, The request body. |
| 232 | The object takes the form of: |
| 233 | |
| 234 | { # An email message. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 235 | "historyId": "A String", # The ID of the last history record that modified this message. |
| 236 | "id": "A String", # The immutable ID of the message. |
| 237 | "internalDate": "A String", # 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. |
| 238 | "labelIds": [ # List of IDs of labels applied to this message. |
| 239 | "A String", |
| 240 | ], |
| 241 | "payload": { # A single MIME message part. # The parsed email structure in the message parts. |
| 242 | "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. |
| 243 | "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. |
| 244 | "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. |
| 245 | "size": 42, # Number of bytes for the message part data (encoding notwithstanding). |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 246 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 247 | "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. |
| 248 | "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 249 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 250 | "name": "A String", # The name of the header before the : separator. For example, To. |
| 251 | "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 252 | }, |
| 253 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 254 | "mimeType": "A String", # The MIME type of the message part. |
| 255 | "partId": "A String", # The immutable ID of the message part. |
| 256 | "parts": [ # 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. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 257 | # Object with schema name: MessagePart |
| 258 | ], |
| 259 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 260 | "raw": "A String", # 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. |
| 261 | "sizeEstimate": 42, # Estimated size in bytes of the message. |
| 262 | "snippet": "A String", # A short part of the message text. |
| 263 | "threadId": "A 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: |
| 264 | # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. |
| 265 | # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. |
| 266 | # - The Subject headers must match. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 267 | } |
| 268 | |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 269 | deleted: boolean, Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a Vault administrator. Only used for G Suite accounts. |
| 270 | internalDateSource: string, Source for Gmail's internal date of the message. |
Craig Citro | 0e5b9bf | 2014-10-15 10:26:14 -0700 | [diff] [blame] | 271 | Allowed values |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 272 | dateHeader - |
| 273 | receivedTime - |
| 274 | neverMarkSpam: boolean, Ignore the Gmail spam classifier decision and never mark this email as SPAM in the mailbox. |
| 275 | processForCalendar: boolean, Process calendar invites in the email and add any extracted meetings to the Google Calendar for this user. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 276 | media_body: string, The filename of the media request body, or an instance of a MediaUpload object. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 277 | media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 278 | |
| 279 | Returns: |
| 280 | An object of the form: |
| 281 | |
| 282 | { # An email message. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 283 | "historyId": "A String", # The ID of the last history record that modified this message. |
| 284 | "id": "A String", # The immutable ID of the message. |
| 285 | "internalDate": "A String", # 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. |
| 286 | "labelIds": [ # List of IDs of labels applied to this message. |
| 287 | "A String", |
| 288 | ], |
| 289 | "payload": { # A single MIME message part. # The parsed email structure in the message parts. |
| 290 | "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. |
| 291 | "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. |
| 292 | "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. |
| 293 | "size": 42, # Number of bytes for the message part data (encoding notwithstanding). |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 294 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 295 | "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. |
| 296 | "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 297 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 298 | "name": "A String", # The name of the header before the : separator. For example, To. |
| 299 | "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 300 | }, |
| 301 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 302 | "mimeType": "A String", # The MIME type of the message part. |
| 303 | "partId": "A String", # The immutable ID of the message part. |
| 304 | "parts": [ # 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. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 305 | # Object with schema name: MessagePart |
| 306 | ], |
| 307 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 308 | "raw": "A String", # 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. |
| 309 | "sizeEstimate": 42, # Estimated size in bytes of the message. |
| 310 | "snippet": "A String", # A short part of the message text. |
| 311 | "threadId": "A 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: |
| 312 | # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. |
| 313 | # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. |
| 314 | # - The Subject headers must match. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 315 | }</pre> |
| 316 | </div> |
| 317 | |
| 318 | <div class="method"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 319 | <code class="details" id="insert">insert(userId, body=None, deleted=None, internalDateSource=None, media_body=None, media_mime_type=None)</code> |
| 320 | <pre>Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 321 | |
| 322 | Args: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 323 | userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) |
| 324 | body: object, The request body. |
| 325 | The object takes the form of: |
| 326 | |
| 327 | { # An email message. |
| 328 | "historyId": "A String", # The ID of the last history record that modified this message. |
| 329 | "id": "A String", # The immutable ID of the message. |
| 330 | "internalDate": "A String", # 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. |
| 331 | "labelIds": [ # List of IDs of labels applied to this message. |
| 332 | "A String", |
| 333 | ], |
| 334 | "payload": { # A single MIME message part. # The parsed email structure in the message parts. |
| 335 | "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. |
| 336 | "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. |
| 337 | "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. |
| 338 | "size": 42, # Number of bytes for the message part data (encoding notwithstanding). |
| 339 | }, |
| 340 | "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. |
| 341 | "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject. |
| 342 | { |
| 343 | "name": "A String", # The name of the header before the : separator. For example, To. |
| 344 | "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. |
| 345 | }, |
| 346 | ], |
| 347 | "mimeType": "A String", # The MIME type of the message part. |
| 348 | "partId": "A String", # The immutable ID of the message part. |
| 349 | "parts": [ # 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. |
| 350 | # Object with schema name: MessagePart |
| 351 | ], |
| 352 | }, |
| 353 | "raw": "A String", # 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. |
| 354 | "sizeEstimate": 42, # Estimated size in bytes of the message. |
| 355 | "snippet": "A String", # A short part of the message text. |
| 356 | "threadId": "A 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: |
| 357 | # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. |
| 358 | # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. |
| 359 | # - The Subject headers must match. |
| 360 | } |
| 361 | |
| 362 | deleted: boolean, Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a Vault administrator. Only used for G Suite accounts. |
| 363 | internalDateSource: string, Source for Gmail's internal date of the message. |
| 364 | Allowed values |
| 365 | dateHeader - |
| 366 | receivedTime - |
| 367 | media_body: string, The filename of the media request body, or an instance of a MediaUpload object. |
| 368 | media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object. |
| 369 | |
| 370 | Returns: |
| 371 | An object of the form: |
| 372 | |
| 373 | { # An email message. |
| 374 | "historyId": "A String", # The ID of the last history record that modified this message. |
| 375 | "id": "A String", # The immutable ID of the message. |
| 376 | "internalDate": "A String", # 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. |
| 377 | "labelIds": [ # List of IDs of labels applied to this message. |
| 378 | "A String", |
| 379 | ], |
| 380 | "payload": { # A single MIME message part. # The parsed email structure in the message parts. |
| 381 | "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. |
| 382 | "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. |
| 383 | "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. |
| 384 | "size": 42, # Number of bytes for the message part data (encoding notwithstanding). |
| 385 | }, |
| 386 | "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. |
| 387 | "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject. |
| 388 | { |
| 389 | "name": "A String", # The name of the header before the : separator. For example, To. |
| 390 | "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. |
| 391 | }, |
| 392 | ], |
| 393 | "mimeType": "A String", # The MIME type of the message part. |
| 394 | "partId": "A String", # The immutable ID of the message part. |
| 395 | "parts": [ # 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. |
| 396 | # Object with schema name: MessagePart |
| 397 | ], |
| 398 | }, |
| 399 | "raw": "A String", # 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. |
| 400 | "sizeEstimate": 42, # Estimated size in bytes of the message. |
| 401 | "snippet": "A String", # A short part of the message text. |
| 402 | "threadId": "A 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: |
| 403 | # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. |
| 404 | # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. |
| 405 | # - The Subject headers must match. |
| 406 | }</pre> |
| 407 | </div> |
| 408 | |
| 409 | <div class="method"> |
| 410 | <code class="details" id="list">list(userId, includeSpamTrash=None, labelIds=None, maxResults=None, pageToken=None, q=None)</code> |
| 411 | <pre>Lists the messages in the user's mailbox. |
| 412 | |
| 413 | Args: |
| 414 | userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) |
| 415 | includeSpamTrash: boolean, Include messages from SPAM and TRASH in the results. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 416 | labelIds: string, Only return messages with labels that match all of the specified label IDs. (repeated) |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 417 | maxResults: integer, Maximum number of messages to return. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 418 | pageToken: string, Page token to retrieve a specific page of results in the list. |
| 419 | q: string, Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, "from:someuser@example.com rfc822msgid:<somemsgid@example.com> is:unread". Parameter cannot be used when accessing the api using the gmail.metadata scope. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 420 | |
| 421 | Returns: |
| 422 | An object of the form: |
| 423 | |
| 424 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 425 | "messages": [ # List of messages. Note that each message resource contains only an id and a threadId. Additional message details can be fetched using the messages.get method. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 426 | { # An email message. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 427 | "historyId": "A String", # The ID of the last history record that modified this message. |
| 428 | "id": "A String", # The immutable ID of the message. |
| 429 | "internalDate": "A String", # 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. |
| 430 | "labelIds": [ # List of IDs of labels applied to this message. |
| 431 | "A String", |
| 432 | ], |
| 433 | "payload": { # A single MIME message part. # The parsed email structure in the message parts. |
| 434 | "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. |
| 435 | "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. |
| 436 | "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. |
| 437 | "size": 42, # Number of bytes for the message part data (encoding notwithstanding). |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 438 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 439 | "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. |
| 440 | "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 441 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 442 | "name": "A String", # The name of the header before the : separator. For example, To. |
| 443 | "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 444 | }, |
| 445 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 446 | "mimeType": "A String", # The MIME type of the message part. |
| 447 | "partId": "A String", # The immutable ID of the message part. |
| 448 | "parts": [ # 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. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 449 | # Object with schema name: MessagePart |
| 450 | ], |
| 451 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 452 | "raw": "A String", # 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. |
| 453 | "sizeEstimate": 42, # Estimated size in bytes of the message. |
| 454 | "snippet": "A String", # A short part of the message text. |
| 455 | "threadId": "A 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: |
| 456 | # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. |
| 457 | # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. |
| 458 | # - The Subject headers must match. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 459 | }, |
| 460 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 461 | "nextPageToken": "A String", # Token to retrieve the next page of results in the list. |
| 462 | "resultSizeEstimate": 42, # Estimated total number of results. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 463 | }</pre> |
| 464 | </div> |
| 465 | |
| 466 | <div class="method"> |
| 467 | <code class="details" id="list_next">list_next(previous_request, previous_response)</code> |
| 468 | <pre>Retrieves the next page of results. |
| 469 | |
| 470 | Args: |
| 471 | previous_request: The request for the previous page. (required) |
| 472 | previous_response: The response from the request for the previous page. (required) |
| 473 | |
| 474 | Returns: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 475 | A request object that you can call 'execute()' on to request the next |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 476 | page. Returns None if there are no more items in the collection. |
| 477 | </pre> |
| 478 | </div> |
| 479 | |
| 480 | <div class="method"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 481 | <code class="details" id="modify">modify(userId, id, body=None)</code> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 482 | <pre>Modifies the labels on the specified message. |
| 483 | |
| 484 | Args: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 485 | userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 486 | id: string, The ID of the message to modify. (required) |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 487 | body: object, The request body. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 488 | The object takes the form of: |
| 489 | |
| 490 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 491 | "addLabelIds": [ # A list of IDs of labels to add to this message. |
| 492 | "A String", |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 493 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 494 | "removeLabelIds": [ # A list IDs of labels to remove from this message. |
| 495 | "A String", |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 496 | ], |
| 497 | } |
| 498 | |
| 499 | |
| 500 | Returns: |
| 501 | An object of the form: |
| 502 | |
| 503 | { # An email message. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 504 | "historyId": "A String", # The ID of the last history record that modified this message. |
| 505 | "id": "A String", # The immutable ID of the message. |
| 506 | "internalDate": "A String", # 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. |
| 507 | "labelIds": [ # List of IDs of labels applied to this message. |
| 508 | "A String", |
| 509 | ], |
| 510 | "payload": { # A single MIME message part. # The parsed email structure in the message parts. |
| 511 | "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. |
| 512 | "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. |
| 513 | "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. |
| 514 | "size": 42, # Number of bytes for the message part data (encoding notwithstanding). |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 515 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 516 | "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. |
| 517 | "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 518 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 519 | "name": "A String", # The name of the header before the : separator. For example, To. |
| 520 | "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 521 | }, |
| 522 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 523 | "mimeType": "A String", # The MIME type of the message part. |
| 524 | "partId": "A String", # The immutable ID of the message part. |
| 525 | "parts": [ # 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. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 526 | # Object with schema name: MessagePart |
| 527 | ], |
| 528 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 529 | "raw": "A String", # 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. |
| 530 | "sizeEstimate": 42, # Estimated size in bytes of the message. |
| 531 | "snippet": "A String", # A short part of the message text. |
| 532 | "threadId": "A 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: |
| 533 | # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. |
| 534 | # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. |
| 535 | # - The Subject headers must match. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 536 | }</pre> |
| 537 | </div> |
| 538 | |
| 539 | <div class="method"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 540 | <code class="details" id="send">send(userId, body=None, media_body=None, media_mime_type=None)</code> |
| 541 | <pre>Sends the specified message to the recipients in the To, Cc, and Bcc headers. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 542 | |
| 543 | Args: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 544 | userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 545 | body: object, The request body. |
| 546 | The object takes the form of: |
| 547 | |
| 548 | { # An email message. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 549 | "historyId": "A String", # The ID of the last history record that modified this message. |
| 550 | "id": "A String", # The immutable ID of the message. |
| 551 | "internalDate": "A String", # 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. |
| 552 | "labelIds": [ # List of IDs of labels applied to this message. |
| 553 | "A String", |
| 554 | ], |
| 555 | "payload": { # A single MIME message part. # The parsed email structure in the message parts. |
| 556 | "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. |
| 557 | "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. |
| 558 | "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. |
| 559 | "size": 42, # Number of bytes for the message part data (encoding notwithstanding). |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 560 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 561 | "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. |
| 562 | "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 563 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 564 | "name": "A String", # The name of the header before the : separator. For example, To. |
| 565 | "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 566 | }, |
| 567 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 568 | "mimeType": "A String", # The MIME type of the message part. |
| 569 | "partId": "A String", # The immutable ID of the message part. |
| 570 | "parts": [ # 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. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 571 | # Object with schema name: MessagePart |
| 572 | ], |
| 573 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 574 | "raw": "A String", # 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. |
| 575 | "sizeEstimate": 42, # Estimated size in bytes of the message. |
| 576 | "snippet": "A String", # A short part of the message text. |
| 577 | "threadId": "A 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: |
| 578 | # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. |
| 579 | # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. |
| 580 | # - The Subject headers must match. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 581 | } |
| 582 | |
| 583 | media_body: string, The filename of the media request body, or an instance of a MediaUpload object. |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 584 | media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 585 | |
| 586 | Returns: |
| 587 | An object of the form: |
| 588 | |
| 589 | { # An email message. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 590 | "historyId": "A String", # The ID of the last history record that modified this message. |
| 591 | "id": "A String", # The immutable ID of the message. |
| 592 | "internalDate": "A String", # 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. |
| 593 | "labelIds": [ # List of IDs of labels applied to this message. |
| 594 | "A String", |
| 595 | ], |
| 596 | "payload": { # A single MIME message part. # The parsed email structure in the message parts. |
| 597 | "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. |
| 598 | "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. |
| 599 | "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. |
| 600 | "size": 42, # Number of bytes for the message part data (encoding notwithstanding). |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 601 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 602 | "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. |
| 603 | "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 604 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 605 | "name": "A String", # The name of the header before the : separator. For example, To. |
| 606 | "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 607 | }, |
| 608 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 609 | "mimeType": "A String", # The MIME type of the message part. |
| 610 | "partId": "A String", # The immutable ID of the message part. |
| 611 | "parts": [ # 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. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 612 | # Object with schema name: MessagePart |
| 613 | ], |
| 614 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 615 | "raw": "A String", # 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. |
| 616 | "sizeEstimate": 42, # Estimated size in bytes of the message. |
| 617 | "snippet": "A String", # A short part of the message text. |
| 618 | "threadId": "A 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: |
| 619 | # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. |
| 620 | # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. |
| 621 | # - The Subject headers must match. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 622 | }</pre> |
| 623 | </div> |
| 624 | |
| 625 | <div class="method"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 626 | <code class="details" id="trash">trash(userId, id)</code> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 627 | <pre>Moves the specified message to the trash. |
| 628 | |
| 629 | Args: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 630 | userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 631 | id: string, The ID of the message to Trash. (required) |
| 632 | |
| 633 | Returns: |
| 634 | An object of the form: |
| 635 | |
| 636 | { # An email message. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 637 | "historyId": "A String", # The ID of the last history record that modified this message. |
| 638 | "id": "A String", # The immutable ID of the message. |
| 639 | "internalDate": "A String", # 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. |
| 640 | "labelIds": [ # List of IDs of labels applied to this message. |
| 641 | "A String", |
| 642 | ], |
| 643 | "payload": { # A single MIME message part. # The parsed email structure in the message parts. |
| 644 | "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. |
| 645 | "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. |
| 646 | "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. |
| 647 | "size": 42, # Number of bytes for the message part data (encoding notwithstanding). |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 648 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 649 | "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. |
| 650 | "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 651 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 652 | "name": "A String", # The name of the header before the : separator. For example, To. |
| 653 | "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 654 | }, |
| 655 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 656 | "mimeType": "A String", # The MIME type of the message part. |
| 657 | "partId": "A String", # The immutable ID of the message part. |
| 658 | "parts": [ # 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. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 659 | # Object with schema name: MessagePart |
| 660 | ], |
| 661 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 662 | "raw": "A String", # 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. |
| 663 | "sizeEstimate": 42, # Estimated size in bytes of the message. |
| 664 | "snippet": "A String", # A short part of the message text. |
| 665 | "threadId": "A 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: |
| 666 | # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. |
| 667 | # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. |
| 668 | # - The Subject headers must match. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 669 | }</pre> |
| 670 | </div> |
| 671 | |
| 672 | <div class="method"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 673 | <code class="details" id="untrash">untrash(userId, id)</code> |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 674 | <pre>Removes the specified message from the trash. |
| 675 | |
| 676 | Args: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 677 | userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 678 | id: string, The ID of the message to remove from Trash. (required) |
| 679 | |
| 680 | Returns: |
| 681 | An object of the form: |
| 682 | |
| 683 | { # An email message. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 684 | "historyId": "A String", # The ID of the last history record that modified this message. |
| 685 | "id": "A String", # The immutable ID of the message. |
| 686 | "internalDate": "A String", # 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. |
| 687 | "labelIds": [ # List of IDs of labels applied to this message. |
| 688 | "A String", |
| 689 | ], |
| 690 | "payload": { # A single MIME message part. # The parsed email structure in the message parts. |
| 691 | "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. |
| 692 | "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate messages.attachments.get request. When not present, the entire content of the message part body is contained in the data field. |
| 693 | "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. |
| 694 | "size": 42, # Number of bytes for the message part data (encoding notwithstanding). |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 695 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 696 | "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. |
| 697 | "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 698 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 699 | "name": "A String", # The name of the header before the : separator. For example, To. |
| 700 | "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 701 | }, |
| 702 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 703 | "mimeType": "A String", # The MIME type of the message part. |
| 704 | "partId": "A String", # The immutable ID of the message part. |
| 705 | "parts": [ # 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. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 706 | # Object with schema name: MessagePart |
| 707 | ], |
| 708 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 709 | "raw": "A String", # 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. |
| 710 | "sizeEstimate": 42, # Estimated size in bytes of the message. |
| 711 | "snippet": "A String", # A short part of the message text. |
| 712 | "threadId": "A 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: |
| 713 | # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. |
| 714 | # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. |
| 715 | # - The Subject headers must match. |
Craig Citro | 065b530 | 2014-08-14 00:47:23 -0700 | [diff] [blame] | 716 | }</pre> |
| 717 | </div> |
| 718 | |
| 719 | </body></html> |