blob: f21c06945b8bccf912257d36331d138bf982b730 [file] [log] [blame]
Craig Citro065b5302014-08-14 00:47:23 -07001<html><body>
2<style>
3
4body, 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
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, 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 Kim65020912020-05-20 12:08:20 -070083 <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 Parrott0a471d32016-05-19 10:54:38 -070085<p class="toc_element">
Bu Sun Kim65020912020-05-20 12:08:20 -070086 <code><a href="#batchModify">batchModify(userId, body=None)</a></code></p>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080087<p class="firstline">Modifies the labels on the specified messages.</p>
88<p class="toc_element">
Bu Sun Kim65020912020-05-20 12:08:20 -070089 <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 Citro065b5302014-08-14 00:47:23 -070091<p class="toc_element">
Bu Sun Kim65020912020-05-20 12:08:20 -070092 <code><a href="#get">get(userId, id, format=None, metadataHeaders=None)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -070093<p class="firstline">Gets the specified message.</p>
94<p class="toc_element">
Bu Sun Kim65020912020-05-20 12:08:20 -070095 <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 Citro065b5302014-08-14 00:47:23 -070097<p class="toc_element">
Bu Sun Kim65020912020-05-20 12:08:20 -070098 <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 Citro065b5302014-08-14 00:47:23 -0700100<p class="toc_element">
Bu Sun Kim65020912020-05-20 12:08:20 -0700101 <code><a href="#list">list(userId, includeSpamTrash=None, labelIds=None, maxResults=None, pageToken=None, q=None)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -0700102<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 Kim65020912020-05-20 12:08:20 -0700107 <code><a href="#modify">modify(userId, id, body=None)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -0700108<p class="firstline">Modifies the labels on the specified message.</p>
109<p class="toc_element">
Bu Sun Kim65020912020-05-20 12:08:20 -0700110 <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 Citro065b5302014-08-14 00:47:23 -0700112<p class="toc_element">
Bu Sun Kim65020912020-05-20 12:08:20 -0700113 <code><a href="#trash">trash(userId, id)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -0700114<p class="firstline">Moves the specified message to the trash.</p>
115<p class="toc_element">
Bu Sun Kim65020912020-05-20 12:08:20 -0700116 <code><a href="#untrash">untrash(userId, id)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -0700117<p class="firstline">Removes the specified message from the trash.</p>
118<h3>Method Details</h3>
119<div class="method">
Bu Sun Kim65020912020-05-20 12:08:20 -0700120 <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 Parrott0a471d32016-05-19 10:54:38 -0700122
123Args:
Bu Sun Kim65020912020-05-20 12:08:20 -0700124 userId: string, The user&#x27;s email address. The special value me can be used to indicate the authenticated user. (required)
Dan O'Mearadd494642020-05-01 07:42:23 -0700125 body: object, The request body.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700126 The object takes the form of:
127
128{
Bu Sun Kim65020912020-05-20 12:08:20 -0700129 &quot;ids&quot;: [ # The IDs of the messages to delete.
130 &quot;A String&quot;,
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700131 ],
132 }
133
134</pre>
135</div>
136
137<div class="method">
Bu Sun Kim65020912020-05-20 12:08:20 -0700138 <code class="details" id="batchModify">batchModify(userId, body=None)</code>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800139 <pre>Modifies the labels on the specified messages.
140
141Args:
Bu Sun Kim65020912020-05-20 12:08:20 -0700142 userId: string, The user&#x27;s email address. The special value me can be used to indicate the authenticated user. (required)
Dan O'Mearadd494642020-05-01 07:42:23 -0700143 body: object, The request body.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800144 The object takes the form of:
145
146{
Bu Sun Kim65020912020-05-20 12:08:20 -0700147 &quot;addLabelIds&quot;: [ # A list of label IDs to add to messages.
148 &quot;A String&quot;,
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800149 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700150 &quot;ids&quot;: [ # The IDs of the messages to modify. There is a limit of 1000 ids per request.
151 &quot;A String&quot;,
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800152 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700153 &quot;removeLabelIds&quot;: [ # A list of label IDs to remove from messages.
154 &quot;A String&quot;,
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800155 ],
156 }
157
158</pre>
159</div>
160
161<div class="method">
Bu Sun Kim65020912020-05-20 12:08:20 -0700162 <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 Citro065b5302014-08-14 00:47:23 -0700164
165Args:
Bu Sun Kim65020912020-05-20 12:08:20 -0700166 userId: string, The user&#x27;s email address. The special value me can be used to indicate the authenticated user. (required)
Craig Citro065b5302014-08-14 00:47:23 -0700167 id: string, The ID of the message to delete. (required)
168</pre>
169</div>
170
171<div class="method">
Bu Sun Kim65020912020-05-20 12:08:20 -0700172 <code class="details" id="get">get(userId, id, format=None, metadataHeaders=None)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700173 <pre>Gets the specified message.
174
175Args:
Bu Sun Kim65020912020-05-20 12:08:20 -0700176 userId: string, The user&#x27;s email address. The special value me can be used to indicate the authenticated user. (required)
Craig Citro065b5302014-08-14 00:47:23 -0700177 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 Kim65020912020-05-20 12:08:20 -0700180 full -
181 metadata -
182 minimal -
183 raw -
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700184 metadataHeaders: string, When given and format is METADATA, only include headers specified. (repeated)
Craig Citro065b5302014-08-14 00:47:23 -0700185
186Returns:
187 An object of the form:
188
189 { # An email message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700190 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
191 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
192 &quot;internalDate&quot;: &quot;A String&quot;, # 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 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
194 &quot;A String&quot;,
195 ],
196 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
197 &quot;body&quot;: { # 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 &quot;attachmentId&quot;: &quot;A String&quot;, # 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 &quot;data&quot;: &quot;A String&quot;, # 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 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700201 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700202 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
203 &quot;headers&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700204 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700205 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the : separator. For example, To.
206 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the : separator. For example, someuser@example.com.
Craig Citro065b5302014-08-14 00:47:23 -0700207 },
208 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700209 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
210 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
211 &quot;parts&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700212 # Object with schema name: MessagePart
213 ],
214 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700215 &quot;raw&quot;: &quot;A String&quot;, # 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 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
217 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
218 &quot;threadId&quot;: &quot;A String&quot;, # 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 Citro065b5302014-08-14 00:47:23 -0700222 }</pre>
223</div>
224
225<div class="method">
Bu Sun Kim65020912020-05-20 12:08:20 -0700226 <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&#x27;s mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. Does not send a message.
Craig Citro065b5302014-08-14 00:47:23 -0700228
229Args:
Bu Sun Kim65020912020-05-20 12:08:20 -0700230 userId: string, The user&#x27;s email address. The special value me can be used to indicate the authenticated user. (required)
Craig Citro065b5302014-08-14 00:47:23 -0700231 body: object, The request body.
232 The object takes the form of:
233
234{ # An email message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700235 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
236 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
237 &quot;internalDate&quot;: &quot;A String&quot;, # 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 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
239 &quot;A String&quot;,
240 ],
241 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
242 &quot;body&quot;: { # 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 &quot;attachmentId&quot;: &quot;A String&quot;, # 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 &quot;data&quot;: &quot;A String&quot;, # 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 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700246 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700247 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
248 &quot;headers&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700249 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700250 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the : separator. For example, To.
251 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the : separator. For example, someuser@example.com.
Craig Citro065b5302014-08-14 00:47:23 -0700252 },
253 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700254 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
255 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
256 &quot;parts&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700257 # Object with schema name: MessagePart
258 ],
259 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700260 &quot;raw&quot;: &quot;A String&quot;, # 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 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
262 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
263 &quot;threadId&quot;: &quot;A String&quot;, # 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 Citro065b5302014-08-14 00:47:23 -0700267}
268
Bu Sun Kim65020912020-05-20 12:08:20 -0700269 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&#x27;s internal date of the message.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700271 Allowed values
Bu Sun Kim65020912020-05-20 12:08:20 -0700272 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'Mearadd494642020-05-01 07:42:23 -0700276 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800277 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
Craig Citro065b5302014-08-14 00:47:23 -0700278
279Returns:
280 An object of the form:
281
282 { # An email message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700283 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
284 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
285 &quot;internalDate&quot;: &quot;A String&quot;, # 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 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
287 &quot;A String&quot;,
288 ],
289 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
290 &quot;body&quot;: { # 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 &quot;attachmentId&quot;: &quot;A String&quot;, # 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 &quot;data&quot;: &quot;A String&quot;, # 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 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700294 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700295 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
296 &quot;headers&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700297 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700298 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the : separator. For example, To.
299 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the : separator. For example, someuser@example.com.
Craig Citro065b5302014-08-14 00:47:23 -0700300 },
301 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700302 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
303 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
304 &quot;parts&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700305 # Object with schema name: MessagePart
306 ],
307 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700308 &quot;raw&quot;: &quot;A String&quot;, # 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 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
310 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
311 &quot;threadId&quot;: &quot;A String&quot;, # 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 Citro065b5302014-08-14 00:47:23 -0700315 }</pre>
316</div>
317
318<div class="method">
Bu Sun Kim65020912020-05-20 12:08:20 -0700319 <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&#x27;s mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.
Craig Citro065b5302014-08-14 00:47:23 -0700321
322Args:
Bu Sun Kim65020912020-05-20 12:08:20 -0700323 userId: string, The user&#x27;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 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
329 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
330 &quot;internalDate&quot;: &quot;A String&quot;, # 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 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
332 &quot;A String&quot;,
333 ],
334 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
335 &quot;body&quot;: { # 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 &quot;attachmentId&quot;: &quot;A String&quot;, # 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 &quot;data&quot;: &quot;A String&quot;, # 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 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
339 },
340 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
341 &quot;headers&quot;: [ # 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 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the : separator. For example, To.
344 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the : separator. For example, someuser@example.com.
345 },
346 ],
347 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
348 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
349 &quot;parts&quot;: [ # 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 &quot;raw&quot;: &quot;A String&quot;, # 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 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
355 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
356 &quot;threadId&quot;: &quot;A String&quot;, # 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&#x27;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
370Returns:
371 An object of the form:
372
373 { # An email message.
374 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
375 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
376 &quot;internalDate&quot;: &quot;A String&quot;, # 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 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
378 &quot;A String&quot;,
379 ],
380 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
381 &quot;body&quot;: { # 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 &quot;attachmentId&quot;: &quot;A String&quot;, # 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 &quot;data&quot;: &quot;A String&quot;, # 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 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
385 },
386 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
387 &quot;headers&quot;: [ # 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 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the : separator. For example, To.
390 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the : separator. For example, someuser@example.com.
391 },
392 ],
393 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
394 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
395 &quot;parts&quot;: [ # 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 &quot;raw&quot;: &quot;A String&quot;, # 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 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
401 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
402 &quot;threadId&quot;: &quot;A String&quot;, # 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&#x27;s mailbox.
412
413Args:
414 userId: string, The user&#x27;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 Citro065b5302014-08-14 00:47:23 -0700416 labelIds: string, Only return messages with labels that match all of the specified label IDs. (repeated)
Craig Citro065b5302014-08-14 00:47:23 -0700417 maxResults: integer, Maximum number of messages to return.
Bu Sun Kim65020912020-05-20 12:08:20 -0700418 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, &quot;from:someuser@example.com rfc822msgid:&lt;somemsgid@example.com&gt; is:unread&quot;. Parameter cannot be used when accessing the api using the gmail.metadata scope.
Craig Citro065b5302014-08-14 00:47:23 -0700420
421Returns:
422 An object of the form:
423
424 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700425 &quot;messages&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700426 { # An email message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700427 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
428 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
429 &quot;internalDate&quot;: &quot;A String&quot;, # 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 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
431 &quot;A String&quot;,
432 ],
433 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
434 &quot;body&quot;: { # 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 &quot;attachmentId&quot;: &quot;A String&quot;, # 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 &quot;data&quot;: &quot;A String&quot;, # 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 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700438 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700439 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
440 &quot;headers&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700441 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700442 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the : separator. For example, To.
443 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the : separator. For example, someuser@example.com.
Craig Citro065b5302014-08-14 00:47:23 -0700444 },
445 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700446 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
447 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
448 &quot;parts&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700449 # Object with schema name: MessagePart
450 ],
451 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700452 &quot;raw&quot;: &quot;A String&quot;, # 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 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
454 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
455 &quot;threadId&quot;: &quot;A String&quot;, # 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 Citro065b5302014-08-14 00:47:23 -0700459 },
460 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700461 &quot;nextPageToken&quot;: &quot;A String&quot;, # Token to retrieve the next page of results in the list.
462 &quot;resultSizeEstimate&quot;: 42, # Estimated total number of results.
Craig Citro065b5302014-08-14 00:47:23 -0700463 }</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
470Args:
471 previous_request: The request for the previous page. (required)
472 previous_response: The response from the request for the previous page. (required)
473
474Returns:
Bu Sun Kim65020912020-05-20 12:08:20 -0700475 A request object that you can call &#x27;execute()&#x27; on to request the next
Craig Citro065b5302014-08-14 00:47:23 -0700476 page. Returns None if there are no more items in the collection.
477 </pre>
478</div>
479
480<div class="method">
Bu Sun Kim65020912020-05-20 12:08:20 -0700481 <code class="details" id="modify">modify(userId, id, body=None)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700482 <pre>Modifies the labels on the specified message.
483
484Args:
Bu Sun Kim65020912020-05-20 12:08:20 -0700485 userId: string, The user&#x27;s email address. The special value me can be used to indicate the authenticated user. (required)
Craig Citro065b5302014-08-14 00:47:23 -0700486 id: string, The ID of the message to modify. (required)
Dan O'Mearadd494642020-05-01 07:42:23 -0700487 body: object, The request body.
Craig Citro065b5302014-08-14 00:47:23 -0700488 The object takes the form of:
489
490{
Bu Sun Kim65020912020-05-20 12:08:20 -0700491 &quot;addLabelIds&quot;: [ # A list of IDs of labels to add to this message.
492 &quot;A String&quot;,
Craig Citro065b5302014-08-14 00:47:23 -0700493 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700494 &quot;removeLabelIds&quot;: [ # A list IDs of labels to remove from this message.
495 &quot;A String&quot;,
Craig Citro065b5302014-08-14 00:47:23 -0700496 ],
497 }
498
499
500Returns:
501 An object of the form:
502
503 { # An email message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700504 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
505 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
506 &quot;internalDate&quot;: &quot;A String&quot;, # 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 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
508 &quot;A String&quot;,
509 ],
510 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
511 &quot;body&quot;: { # 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 &quot;attachmentId&quot;: &quot;A String&quot;, # 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 &quot;data&quot;: &quot;A String&quot;, # 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 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700515 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700516 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
517 &quot;headers&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700518 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700519 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the : separator. For example, To.
520 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the : separator. For example, someuser@example.com.
Craig Citro065b5302014-08-14 00:47:23 -0700521 },
522 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700523 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
524 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
525 &quot;parts&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700526 # Object with schema name: MessagePart
527 ],
528 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700529 &quot;raw&quot;: &quot;A String&quot;, # 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 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
531 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
532 &quot;threadId&quot;: &quot;A String&quot;, # 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 Citro065b5302014-08-14 00:47:23 -0700536 }</pre>
537</div>
538
539<div class="method">
Bu Sun Kim65020912020-05-20 12:08:20 -0700540 <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 Citro065b5302014-08-14 00:47:23 -0700542
543Args:
Bu Sun Kim65020912020-05-20 12:08:20 -0700544 userId: string, The user&#x27;s email address. The special value me can be used to indicate the authenticated user. (required)
Craig Citro065b5302014-08-14 00:47:23 -0700545 body: object, The request body.
546 The object takes the form of:
547
548{ # An email message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700549 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
550 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
551 &quot;internalDate&quot;: &quot;A String&quot;, # 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 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
553 &quot;A String&quot;,
554 ],
555 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
556 &quot;body&quot;: { # 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 &quot;attachmentId&quot;: &quot;A String&quot;, # 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 &quot;data&quot;: &quot;A String&quot;, # 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 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700560 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700561 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
562 &quot;headers&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700563 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700564 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the : separator. For example, To.
565 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the : separator. For example, someuser@example.com.
Craig Citro065b5302014-08-14 00:47:23 -0700566 },
567 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700568 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
569 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
570 &quot;parts&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700571 # Object with schema name: MessagePart
572 ],
573 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700574 &quot;raw&quot;: &quot;A String&quot;, # 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 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
576 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
577 &quot;threadId&quot;: &quot;A String&quot;, # 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 Citro065b5302014-08-14 00:47:23 -0700581}
582
583 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800584 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
Craig Citro065b5302014-08-14 00:47:23 -0700585
586Returns:
587 An object of the form:
588
589 { # An email message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700590 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
591 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
592 &quot;internalDate&quot;: &quot;A String&quot;, # 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 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
594 &quot;A String&quot;,
595 ],
596 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
597 &quot;body&quot;: { # 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 &quot;attachmentId&quot;: &quot;A String&quot;, # 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 &quot;data&quot;: &quot;A String&quot;, # 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 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700601 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700602 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
603 &quot;headers&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700604 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700605 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the : separator. For example, To.
606 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the : separator. For example, someuser@example.com.
Craig Citro065b5302014-08-14 00:47:23 -0700607 },
608 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700609 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
610 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
611 &quot;parts&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700612 # Object with schema name: MessagePart
613 ],
614 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700615 &quot;raw&quot;: &quot;A String&quot;, # 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 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
617 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
618 &quot;threadId&quot;: &quot;A String&quot;, # 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 Citro065b5302014-08-14 00:47:23 -0700622 }</pre>
623</div>
624
625<div class="method">
Bu Sun Kim65020912020-05-20 12:08:20 -0700626 <code class="details" id="trash">trash(userId, id)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700627 <pre>Moves the specified message to the trash.
628
629Args:
Bu Sun Kim65020912020-05-20 12:08:20 -0700630 userId: string, The user&#x27;s email address. The special value me can be used to indicate the authenticated user. (required)
Craig Citro065b5302014-08-14 00:47:23 -0700631 id: string, The ID of the message to Trash. (required)
632
633Returns:
634 An object of the form:
635
636 { # An email message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700637 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
638 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
639 &quot;internalDate&quot;: &quot;A String&quot;, # 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 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
641 &quot;A String&quot;,
642 ],
643 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
644 &quot;body&quot;: { # 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 &quot;attachmentId&quot;: &quot;A String&quot;, # 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 &quot;data&quot;: &quot;A String&quot;, # 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 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700648 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700649 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
650 &quot;headers&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700651 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700652 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the : separator. For example, To.
653 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the : separator. For example, someuser@example.com.
Craig Citro065b5302014-08-14 00:47:23 -0700654 },
655 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700656 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
657 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
658 &quot;parts&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700659 # Object with schema name: MessagePart
660 ],
661 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700662 &quot;raw&quot;: &quot;A String&quot;, # 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 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
664 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
665 &quot;threadId&quot;: &quot;A String&quot;, # 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 Citro065b5302014-08-14 00:47:23 -0700669 }</pre>
670</div>
671
672<div class="method">
Bu Sun Kim65020912020-05-20 12:08:20 -0700673 <code class="details" id="untrash">untrash(userId, id)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700674 <pre>Removes the specified message from the trash.
675
676Args:
Bu Sun Kim65020912020-05-20 12:08:20 -0700677 userId: string, The user&#x27;s email address. The special value me can be used to indicate the authenticated user. (required)
Craig Citro065b5302014-08-14 00:47:23 -0700678 id: string, The ID of the message to remove from Trash. (required)
679
680Returns:
681 An object of the form:
682
683 { # An email message.
Bu Sun Kim65020912020-05-20 12:08:20 -0700684 &quot;historyId&quot;: &quot;A String&quot;, # The ID of the last history record that modified this message.
685 &quot;id&quot;: &quot;A String&quot;, # The immutable ID of the message.
686 &quot;internalDate&quot;: &quot;A String&quot;, # 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 &quot;labelIds&quot;: [ # List of IDs of labels applied to this message.
688 &quot;A String&quot;,
689 ],
690 &quot;payload&quot;: { # A single MIME message part. # The parsed email structure in the message parts.
691 &quot;body&quot;: { # 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 &quot;attachmentId&quot;: &quot;A String&quot;, # 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 &quot;data&quot;: &quot;A String&quot;, # 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 &quot;size&quot;: 42, # Number of bytes for the message part data (encoding notwithstanding).
Craig Citro065b5302014-08-14 00:47:23 -0700695 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700696 &quot;filename&quot;: &quot;A String&quot;, # The filename of the attachment. Only present if this message part represents an attachment.
697 &quot;headers&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700698 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700699 &quot;name&quot;: &quot;A String&quot;, # The name of the header before the : separator. For example, To.
700 &quot;value&quot;: &quot;A String&quot;, # The value of the header after the : separator. For example, someuser@example.com.
Craig Citro065b5302014-08-14 00:47:23 -0700701 },
702 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700703 &quot;mimeType&quot;: &quot;A String&quot;, # The MIME type of the message part.
704 &quot;partId&quot;: &quot;A String&quot;, # The immutable ID of the message part.
705 &quot;parts&quot;: [ # 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 Citro065b5302014-08-14 00:47:23 -0700706 # Object with schema name: MessagePart
707 ],
708 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700709 &quot;raw&quot;: &quot;A String&quot;, # 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 &quot;sizeEstimate&quot;: 42, # Estimated size in bytes of the message.
711 &quot;snippet&quot;: &quot;A String&quot;, # A short part of the message text.
712 &quot;threadId&quot;: &quot;A String&quot;, # 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 Citro065b5302014-08-14 00:47:23 -0700716 }</pre>
717</div>
718
719</body></html>