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