blob: c8b8d1ac8f50c541bcdfa377eca92314345dbf69 [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">
83 <code><a href="#delete">delete(userId, id)</a></code></p>
84<p class="firstline">Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.</p>
85<p class="toc_element">
Craig Citro0e5b9bf2014-10-15 10:26:14 -070086 <code><a href="#get">get(userId, id, format=None, metadataHeaders=None)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -070087<p class="firstline">Gets the specified message.</p>
88<p class="toc_element">
Craig Citro0e5b9bf2014-10-15 10:26:14 -070089 <code><a href="#import_">import_(userId, body=None, media_body=None, internalDateSource=None)</a></code></p>
90<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 -070091<p class="toc_element">
Craig Citro0e5b9bf2014-10-15 10:26:14 -070092 <code><a href="#insert">insert(userId, body=None, media_body=None, internalDateSource=None)</a></code></p>
93<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 -070094<p class="toc_element">
95 <code><a href="#list">list(userId, labelIds=None, q=None, pageToken=None, maxResults=None, includeSpamTrash=None)</a></code></p>
96<p class="firstline">Lists the messages in the user's mailbox.</p>
97<p class="toc_element">
98 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
99<p class="firstline">Retrieves the next page of results.</p>
100<p class="toc_element">
101 <code><a href="#modify">modify(userId, id, body)</a></code></p>
102<p class="firstline">Modifies the labels on the specified message.</p>
103<p class="toc_element">
104 <code><a href="#send">send(userId, body=None, media_body=None)</a></code></p>
105<p class="firstline">Sends the specified message to the recipients in the To, Cc, and Bcc headers.</p>
106<p class="toc_element">
107 <code><a href="#trash">trash(userId, id)</a></code></p>
108<p class="firstline">Moves the specified message to the trash.</p>
109<p class="toc_element">
110 <code><a href="#untrash">untrash(userId, id)</a></code></p>
111<p class="firstline">Removes the specified message from the trash.</p>
112<h3>Method Details</h3>
113<div class="method">
114 <code class="details" id="delete">delete(userId, id)</code>
115 <pre>Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.
116
117Args:
118 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
119 id: string, The ID of the message to delete. (required)
120</pre>
121</div>
122
123<div class="method">
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700124 <code class="details" id="get">get(userId, id, format=None, metadataHeaders=None)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700125 <pre>Gets the specified message.
126
127Args:
128 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
129 id: string, The ID of the message to retrieve. (required)
130 format: string, The format to return the message in.
131 Allowed values
132 full -
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700133 metadata -
Craig Citro065b5302014-08-14 00:47:23 -0700134 minimal -
135 raw -
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700136 metadataHeaders: string, When given and format is METADATA, only include headers specified. (repeated)
Craig Citro065b5302014-08-14 00:47:23 -0700137
138Returns:
139 An object of the form:
140
141 { # An email message.
142 "historyId": "A String", # The ID of the last history record that modified this message.
143 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
144 "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.
145 "data": "A String", # The body data of a MIME message part. 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.
146 "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.
147 "size": 42, # Total number of bytes in the body of the message part.
148 },
149 "mimeType": "A String", # The MIME type of the message part.
150 "partId": "A String", # The immutable ID of the message part.
151 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
152 "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.
153 {
154 "name": "A String", # The name of the header before the : separator. For example, To.
155 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
156 },
157 ],
158 "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.
159 # Object with schema name: MessagePart
160 ],
161 },
162 "snippet": "A String", # A short part of the message text.
163 "raw": "A String", # The entire email message in an RFC 2822 formatted and URL-safe base64 encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
164 "sizeEstimate": 42, # Estimated size in bytes of the message.
165 "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:
166 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700167 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700168 # - The Subject headers must match.
169 "labelIds": [ # List of IDs of labels applied to this message.
170 "A String",
171 ],
172 "id": "A String", # The immutable ID of the message.
173 }</pre>
174</div>
175
176<div class="method">
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700177 <code class="details" id="import_">import_(userId, body=None, media_body=None, internalDateSource=None)</code>
178 <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 Citro065b5302014-08-14 00:47:23 -0700179
180Args:
181 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
182 body: object, The request body.
183 The object takes the form of:
184
185{ # An email message.
186 "historyId": "A String", # The ID of the last history record that modified this message.
187 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
188 "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.
189 "data": "A String", # The body data of a MIME message part. 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.
190 "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.
191 "size": 42, # Total number of bytes in the body of the message part.
192 },
193 "mimeType": "A String", # The MIME type of the message part.
194 "partId": "A String", # The immutable ID of the message part.
195 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
196 "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.
197 {
198 "name": "A String", # The name of the header before the : separator. For example, To.
199 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
200 },
201 ],
202 "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.
203 # Object with schema name: MessagePart
204 ],
205 },
206 "snippet": "A String", # A short part of the message text.
207 "raw": "A String", # The entire email message in an RFC 2822 formatted and URL-safe base64 encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
208 "sizeEstimate": 42, # Estimated size in bytes of the message.
209 "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:
210 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700211 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700212 # - The Subject headers must match.
213 "labelIds": [ # List of IDs of labels applied to this message.
214 "A String",
215 ],
216 "id": "A String", # The immutable ID of the message.
217}
218
219 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700220 internalDateSource: string, Source for Gmail's internal date of the message.
221 Allowed values
222 dateHeader -
223 receivedTime -
Craig Citro065b5302014-08-14 00:47:23 -0700224
225Returns:
226 An object of the form:
227
228 { # An email message.
229 "historyId": "A String", # The ID of the last history record that modified this message.
230 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
231 "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.
232 "data": "A String", # The body data of a MIME message part. 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.
233 "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.
234 "size": 42, # Total number of bytes in the body of the message part.
235 },
236 "mimeType": "A String", # The MIME type of the message part.
237 "partId": "A String", # The immutable ID of the message part.
238 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
239 "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.
240 {
241 "name": "A String", # The name of the header before the : separator. For example, To.
242 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
243 },
244 ],
245 "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.
246 # Object with schema name: MessagePart
247 ],
248 },
249 "snippet": "A String", # A short part of the message text.
250 "raw": "A String", # The entire email message in an RFC 2822 formatted and URL-safe base64 encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
251 "sizeEstimate": 42, # Estimated size in bytes of the message.
252 "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:
253 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700254 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700255 # - The Subject headers must match.
256 "labelIds": [ # List of IDs of labels applied to this message.
257 "A String",
258 ],
259 "id": "A String", # The immutable ID of the message.
260 }</pre>
261</div>
262
263<div class="method">
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700264 <code class="details" id="insert">insert(userId, body=None, media_body=None, internalDateSource=None)</code>
265 <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 Citro065b5302014-08-14 00:47:23 -0700266
267Args:
268 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
269 body: object, The request body.
270 The object takes the form of:
271
272{ # An email message.
273 "historyId": "A String", # The ID of the last history record that modified this message.
274 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
275 "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.
276 "data": "A String", # The body data of a MIME message part. 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.
277 "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.
278 "size": 42, # Total number of bytes in the body of the message part.
279 },
280 "mimeType": "A String", # The MIME type of the message part.
281 "partId": "A String", # The immutable ID of the message part.
282 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
283 "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.
284 {
285 "name": "A String", # The name of the header before the : separator. For example, To.
286 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
287 },
288 ],
289 "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.
290 # Object with schema name: MessagePart
291 ],
292 },
293 "snippet": "A String", # A short part of the message text.
294 "raw": "A String", # The entire email message in an RFC 2822 formatted and URL-safe base64 encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
295 "sizeEstimate": 42, # Estimated size in bytes of the message.
296 "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:
297 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700298 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700299 # - The Subject headers must match.
300 "labelIds": [ # List of IDs of labels applied to this message.
301 "A String",
302 ],
303 "id": "A String", # The immutable ID of the message.
304}
305
306 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700307 internalDateSource: string, Source for Gmail's internal date of the message.
308 Allowed values
309 dateHeader -
310 receivedTime -
Craig Citro065b5302014-08-14 00:47:23 -0700311
312Returns:
313 An object of the form:
314
315 { # An email message.
316 "historyId": "A String", # The ID of the last history record that modified this message.
317 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
318 "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.
319 "data": "A String", # The body data of a MIME message part. 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.
320 "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.
321 "size": 42, # Total number of bytes in the body of the message part.
322 },
323 "mimeType": "A String", # The MIME type of the message part.
324 "partId": "A String", # The immutable ID of the message part.
325 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
326 "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.
327 {
328 "name": "A String", # The name of the header before the : separator. For example, To.
329 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
330 },
331 ],
332 "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.
333 # Object with schema name: MessagePart
334 ],
335 },
336 "snippet": "A String", # A short part of the message text.
337 "raw": "A String", # The entire email message in an RFC 2822 formatted and URL-safe base64 encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
338 "sizeEstimate": 42, # Estimated size in bytes of the message.
339 "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:
340 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700341 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700342 # - The Subject headers must match.
343 "labelIds": [ # List of IDs of labels applied to this message.
344 "A String",
345 ],
346 "id": "A String", # The immutable ID of the message.
347 }</pre>
348</div>
349
350<div class="method">
351 <code class="details" id="list">list(userId, labelIds=None, q=None, pageToken=None, maxResults=None, includeSpamTrash=None)</code>
352 <pre>Lists the messages in the user's mailbox.
353
354Args:
355 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
356 labelIds: string, Only return messages with labels that match all of the specified label IDs. (repeated)
357 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: is:unread".
358 pageToken: string, Page token to retrieve a specific page of results in the list.
359 maxResults: integer, Maximum number of messages to return.
360 includeSpamTrash: boolean, Include messages from SPAM and TRASH in the results.
361
362Returns:
363 An object of the form:
364
365 {
366 "nextPageToken": "A String", # Token to retrieve the next page of results in the list.
367 "resultSizeEstimate": 42, # Estimated total number of results.
368 "messages": [ # List of messages.
369 { # An email message.
370 "historyId": "A String", # The ID of the last history record that modified this message.
371 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
372 "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.
373 "data": "A String", # The body data of a MIME message part. 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.
374 "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.
375 "size": 42, # Total number of bytes in the body of the message part.
376 },
377 "mimeType": "A String", # The MIME type of the message part.
378 "partId": "A String", # The immutable ID of the message part.
379 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
380 "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.
381 {
382 "name": "A String", # The name of the header before the : separator. For example, To.
383 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
384 },
385 ],
386 "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.
387 # Object with schema name: MessagePart
388 ],
389 },
390 "snippet": "A String", # A short part of the message text.
391 "raw": "A String", # The entire email message in an RFC 2822 formatted and URL-safe base64 encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
392 "sizeEstimate": 42, # Estimated size in bytes of the message.
393 "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:
394 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700395 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700396 # - The Subject headers must match.
397 "labelIds": [ # List of IDs of labels applied to this message.
398 "A String",
399 ],
400 "id": "A String", # The immutable ID of the message.
401 },
402 ],
403 }</pre>
404</div>
405
406<div class="method">
407 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
408 <pre>Retrieves the next page of results.
409
410Args:
411 previous_request: The request for the previous page. (required)
412 previous_response: The response from the request for the previous page. (required)
413
414Returns:
415 A request object that you can call 'execute()' on to request the next
416 page. Returns None if there are no more items in the collection.
417 </pre>
418</div>
419
420<div class="method">
421 <code class="details" id="modify">modify(userId, id, body)</code>
422 <pre>Modifies the labels on the specified message.
423
424Args:
425 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
426 id: string, The ID of the message to modify. (required)
427 body: object, The request body. (required)
428 The object takes the form of:
429
430{
431 "removeLabelIds": [ # A list IDs of labels to remove from this message.
432 "A String",
433 ],
434 "addLabelIds": [ # A list of IDs of labels to add to this message.
435 "A String",
436 ],
437 }
438
439
440Returns:
441 An object of the form:
442
443 { # An email message.
444 "historyId": "A String", # The ID of the last history record that modified this message.
445 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
446 "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.
447 "data": "A String", # The body data of a MIME message part. 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.
448 "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.
449 "size": 42, # Total number of bytes in the body of the message part.
450 },
451 "mimeType": "A String", # The MIME type of the message part.
452 "partId": "A String", # The immutable ID of the message part.
453 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
454 "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.
455 {
456 "name": "A String", # The name of the header before the : separator. For example, To.
457 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
458 },
459 ],
460 "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.
461 # Object with schema name: MessagePart
462 ],
463 },
464 "snippet": "A String", # A short part of the message text.
465 "raw": "A String", # The entire email message in an RFC 2822 formatted and URL-safe base64 encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
466 "sizeEstimate": 42, # Estimated size in bytes of the message.
467 "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:
468 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700469 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700470 # - The Subject headers must match.
471 "labelIds": [ # List of IDs of labels applied to this message.
472 "A String",
473 ],
474 "id": "A String", # The immutable ID of the message.
475 }</pre>
476</div>
477
478<div class="method">
479 <code class="details" id="send">send(userId, body=None, media_body=None)</code>
480 <pre>Sends the specified message to the recipients in the To, Cc, and Bcc headers.
481
482Args:
483 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
484 body: object, The request body.
485 The object takes the form of:
486
487{ # An email message.
488 "historyId": "A String", # The ID of the last history record that modified this message.
489 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
490 "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.
491 "data": "A String", # The body data of a MIME message part. 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.
492 "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.
493 "size": 42, # Total number of bytes in the body of the message part.
494 },
495 "mimeType": "A String", # The MIME type of the message part.
496 "partId": "A String", # The immutable ID of the message part.
497 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
498 "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.
499 {
500 "name": "A String", # The name of the header before the : separator. For example, To.
501 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
502 },
503 ],
504 "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.
505 # Object with schema name: MessagePart
506 ],
507 },
508 "snippet": "A String", # A short part of the message text.
509 "raw": "A String", # The entire email message in an RFC 2822 formatted and URL-safe base64 encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
510 "sizeEstimate": 42, # Estimated size in bytes of the message.
511 "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:
512 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700513 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700514 # - The Subject headers must match.
515 "labelIds": [ # List of IDs of labels applied to this message.
516 "A String",
517 ],
518 "id": "A String", # The immutable ID of the message.
519}
520
521 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
522
523Returns:
524 An object of the form:
525
526 { # An email message.
527 "historyId": "A String", # The ID of the last history record that modified this message.
528 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
529 "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.
530 "data": "A String", # The body data of a MIME message part. 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.
531 "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.
532 "size": 42, # Total number of bytes in the body of the message part.
533 },
534 "mimeType": "A String", # The MIME type of the message part.
535 "partId": "A String", # The immutable ID of the message part.
536 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
537 "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.
538 {
539 "name": "A String", # The name of the header before the : separator. For example, To.
540 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
541 },
542 ],
543 "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.
544 # Object with schema name: MessagePart
545 ],
546 },
547 "snippet": "A String", # A short part of the message text.
548 "raw": "A String", # The entire email message in an RFC 2822 formatted and URL-safe base64 encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
549 "sizeEstimate": 42, # Estimated size in bytes of the message.
550 "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:
551 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700552 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700553 # - The Subject headers must match.
554 "labelIds": [ # List of IDs of labels applied to this message.
555 "A String",
556 ],
557 "id": "A String", # The immutable ID of the message.
558 }</pre>
559</div>
560
561<div class="method">
562 <code class="details" id="trash">trash(userId, id)</code>
563 <pre>Moves the specified message to the trash.
564
565Args:
566 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
567 id: string, The ID of the message to Trash. (required)
568
569Returns:
570 An object of the form:
571
572 { # An email message.
573 "historyId": "A String", # The ID of the last history record that modified this message.
574 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
575 "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.
576 "data": "A String", # The body data of a MIME message part. 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.
577 "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.
578 "size": 42, # Total number of bytes in the body of the message part.
579 },
580 "mimeType": "A String", # The MIME type of the message part.
581 "partId": "A String", # The immutable ID of the message part.
582 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
583 "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.
584 {
585 "name": "A String", # The name of the header before the : separator. For example, To.
586 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
587 },
588 ],
589 "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.
590 # Object with schema name: MessagePart
591 ],
592 },
593 "snippet": "A String", # A short part of the message text.
594 "raw": "A String", # The entire email message in an RFC 2822 formatted and URL-safe base64 encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
595 "sizeEstimate": 42, # Estimated size in bytes of the message.
596 "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:
597 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700598 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700599 # - The Subject headers must match.
600 "labelIds": [ # List of IDs of labels applied to this message.
601 "A String",
602 ],
603 "id": "A String", # The immutable ID of the message.
604 }</pre>
605</div>
606
607<div class="method">
608 <code class="details" id="untrash">untrash(userId, id)</code>
609 <pre>Removes the specified message from the trash.
610
611Args:
612 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
613 id: string, The ID of the message to remove from Trash. (required)
614
615Returns:
616 An object of the form:
617
618 { # An email message.
619 "historyId": "A String", # The ID of the last history record that modified this message.
620 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
621 "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.
622 "data": "A String", # The body data of a MIME message part. 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.
623 "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.
624 "size": 42, # Total number of bytes in the body of the message part.
625 },
626 "mimeType": "A String", # The MIME type of the message part.
627 "partId": "A String", # The immutable ID of the message part.
628 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
629 "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.
630 {
631 "name": "A String", # The name of the header before the : separator. For example, To.
632 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
633 },
634 ],
635 "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.
636 # Object with schema name: MessagePart
637 ],
638 },
639 "snippet": "A String", # A short part of the message text.
640 "raw": "A String", # The entire email message in an RFC 2822 formatted and URL-safe base64 encoded string. Returned in messages.get and drafts.get responses when the format=RAW parameter is supplied.
641 "sizeEstimate": 42, # Estimated size in bytes of the message.
642 "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:
643 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700644 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700645 # - The Subject headers must match.
646 "labelIds": [ # List of IDs of labels applied to this message.
647 "A String",
648 ],
649 "id": "A String", # The immutable ID of the message.
650 }</pre>
651</div>
652
653</body></html>