blob: 65bb8709c150efbff4d150bcba7d4b4ebcfb0dc5 [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">
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -070083 <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">
Craig Citro065b5302014-08-14 00:47:23 -070086 <code><a href="#delete">delete(userId, id)</a></code></p>
87<p class="firstline">Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.</p>
88<p class="toc_element">
Craig Citro0e5b9bf2014-10-15 10:26:14 -070089 <code><a href="#get">get(userId, id, format=None, metadataHeaders=None)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -070090<p class="firstline">Gets the specified message.</p>
91<p class="toc_element">
Craig Citroe633be12015-03-02 13:40:36 -080092 <code><a href="#import_">import_(userId, body=None, media_body=None, internalDateSource=None, neverMarkSpam=None, processForCalendar=None, deleted=None)</a></code></p>
Craig Citro0e5b9bf2014-10-15 10:26:14 -070093<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 -070094<p class="toc_element">
Nathaniel Manista4f877e52015-06-15 16:44:50 +000095 <code><a href="#insert">insert(userId, body=None, media_body=None, internalDateSource=None, deleted=None)</a></code></p>
Craig Citro0e5b9bf2014-10-15 10:26:14 -070096<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 -070097<p class="toc_element">
98 <code><a href="#list">list(userId, labelIds=None, q=None, pageToken=None, maxResults=None, includeSpamTrash=None)</a></code></p>
99<p class="firstline">Lists the messages in the user's mailbox.</p>
100<p class="toc_element">
101 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
102<p class="firstline">Retrieves the next page of results.</p>
103<p class="toc_element">
104 <code><a href="#modify">modify(userId, id, body)</a></code></p>
105<p class="firstline">Modifies the labels on the specified message.</p>
106<p class="toc_element">
107 <code><a href="#send">send(userId, body=None, media_body=None)</a></code></p>
108<p class="firstline">Sends the specified message to the recipients in the To, Cc, and Bcc headers.</p>
109<p class="toc_element">
110 <code><a href="#trash">trash(userId, id)</a></code></p>
111<p class="firstline">Moves the specified message to the trash.</p>
112<p class="toc_element">
113 <code><a href="#untrash">untrash(userId, id)</a></code></p>
114<p class="firstline">Removes the specified message from the trash.</p>
115<h3>Method Details</h3>
116<div class="method">
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700117 <code class="details" id="batchDelete">batchDelete(userId, body)</code>
118 <pre>Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all.
119
120Args:
121 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
122 body: object, The request body. (required)
123 The object takes the form of:
124
125{
126 "ids": [ # The IDs of the messages to delete.
127 "A String",
128 ],
129 }
130
131</pre>
132</div>
133
134<div class="method">
Craig Citro065b5302014-08-14 00:47:23 -0700135 <code class="details" id="delete">delete(userId, id)</code>
136 <pre>Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.
137
138Args:
139 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
140 id: string, The ID of the message to delete. (required)
141</pre>
142</div>
143
144<div class="method">
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700145 <code class="details" id="get">get(userId, id, format=None, metadataHeaders=None)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700146 <pre>Gets the specified message.
147
148Args:
149 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
150 id: string, The ID of the message to retrieve. (required)
151 format: string, The format to return the message in.
152 Allowed values
153 full -
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700154 metadata -
Craig Citro065b5302014-08-14 00:47:23 -0700155 minimal -
156 raw -
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700157 metadataHeaders: string, When given and format is METADATA, only include headers specified. (repeated)
Craig Citro065b5302014-08-14 00:47:23 -0700158
159Returns:
160 An object of the form:
161
162 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700163 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700164 "historyId": "A String", # The ID of the last history record that modified this message.
165 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
166 "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.
167 "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.
168 "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.
169 "size": 42, # Total number of bytes in the body of the message part.
170 },
171 "mimeType": "A String", # The MIME type of the message part.
172 "partId": "A String", # The immutable ID of the message part.
173 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
174 "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.
175 {
176 "name": "A String", # The name of the header before the : separator. For example, To.
177 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
178 },
179 ],
180 "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.
181 # Object with schema name: MessagePart
182 ],
183 },
184 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800185 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700186 "sizeEstimate": 42, # Estimated size in bytes of the message.
187 "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:
188 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700189 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700190 # - The Subject headers must match.
191 "labelIds": [ # List of IDs of labels applied to this message.
192 "A String",
193 ],
194 "id": "A String", # The immutable ID of the message.
195 }</pre>
196</div>
197
198<div class="method">
Craig Citroe633be12015-03-02 13:40:36 -0800199 <code class="details" id="import_">import_(userId, body=None, media_body=None, internalDateSource=None, neverMarkSpam=None, processForCalendar=None, deleted=None)</code>
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700200 <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 -0700201
202Args:
203 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
204 body: object, The request body.
205 The object takes the form of:
206
207{ # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700208 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700209 "historyId": "A String", # The ID of the last history record that modified this message.
210 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
211 "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.
212 "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.
213 "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.
214 "size": 42, # Total number of bytes in the body of the message part.
215 },
216 "mimeType": "A String", # The MIME type of the message part.
217 "partId": "A String", # The immutable ID of the message part.
218 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
219 "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.
220 {
221 "name": "A String", # The name of the header before the : separator. For example, To.
222 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
223 },
224 ],
225 "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.
226 # Object with schema name: MessagePart
227 ],
228 },
229 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800230 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700231 "sizeEstimate": 42, # Estimated size in bytes of the message.
232 "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:
233 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700234 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700235 # - The Subject headers must match.
236 "labelIds": [ # List of IDs of labels applied to this message.
237 "A String",
238 ],
239 "id": "A String", # The immutable ID of the message.
240}
241
242 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700243 internalDateSource: string, Source for Gmail's internal date of the message.
244 Allowed values
245 dateHeader -
246 receivedTime -
Craig Citroe633be12015-03-02 13:40:36 -0800247 neverMarkSpam: boolean, Ignore the Gmail spam classifier decision and never mark this email as SPAM in the mailbox.
248 processForCalendar: boolean, Process calendar invites in the email and add any extracted meetings to the Google Calendar for this user.
249 deleted: boolean, Mark the email as permanently deleted (not TRASH) and only visible in Google Apps Vault to a Vault administrator. Only used for Google Apps for Work accounts.
Craig Citro065b5302014-08-14 00:47:23 -0700250
251Returns:
252 An object of the form:
253
254 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700255 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700256 "historyId": "A String", # The ID of the last history record that modified this message.
257 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
258 "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.
259 "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.
260 "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.
261 "size": 42, # Total number of bytes in the body of the message part.
262 },
263 "mimeType": "A String", # The MIME type of the message part.
264 "partId": "A String", # The immutable ID of the message part.
265 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
266 "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.
267 {
268 "name": "A String", # The name of the header before the : separator. For example, To.
269 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
270 },
271 ],
272 "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.
273 # Object with schema name: MessagePart
274 ],
275 },
276 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800277 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700278 "sizeEstimate": 42, # Estimated size in bytes of the message.
279 "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:
280 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700281 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700282 # - The Subject headers must match.
283 "labelIds": [ # List of IDs of labels applied to this message.
284 "A String",
285 ],
286 "id": "A String", # The immutable ID of the message.
287 }</pre>
288</div>
289
290<div class="method">
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000291 <code class="details" id="insert">insert(userId, body=None, media_body=None, internalDateSource=None, deleted=None)</code>
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700292 <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 -0700293
294Args:
295 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
296 body: object, The request body.
297 The object takes the form of:
298
299{ # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700300 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700301 "historyId": "A String", # The ID of the last history record that modified this message.
302 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
303 "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.
304 "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.
305 "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.
306 "size": 42, # Total number of bytes in the body of the message part.
307 },
308 "mimeType": "A String", # The MIME type of the message part.
309 "partId": "A String", # The immutable ID of the message part.
310 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
311 "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.
312 {
313 "name": "A String", # The name of the header before the : separator. For example, To.
314 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
315 },
316 ],
317 "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.
318 # Object with schema name: MessagePart
319 ],
320 },
321 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800322 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700323 "sizeEstimate": 42, # Estimated size in bytes of the message.
324 "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:
325 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700326 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700327 # - The Subject headers must match.
328 "labelIds": [ # List of IDs of labels applied to this message.
329 "A String",
330 ],
331 "id": "A String", # The immutable ID of the message.
332}
333
334 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700335 internalDateSource: string, Source for Gmail's internal date of the message.
336 Allowed values
337 dateHeader -
338 receivedTime -
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000339 deleted: boolean, Mark the email as permanently deleted (not TRASH) and only visible in Google Apps Vault to a Vault administrator. Only used for Google Apps for Work accounts.
Craig Citro065b5302014-08-14 00:47:23 -0700340
341Returns:
342 An object of the form:
343
344 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700345 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700346 "historyId": "A String", # The ID of the last history record that modified this message.
347 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
348 "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.
349 "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.
350 "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.
351 "size": 42, # Total number of bytes in the body of the message part.
352 },
353 "mimeType": "A String", # The MIME type of the message part.
354 "partId": "A String", # The immutable ID of the message part.
355 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
356 "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.
357 {
358 "name": "A String", # The name of the header before the : separator. For example, To.
359 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
360 },
361 ],
362 "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.
363 # Object with schema name: MessagePart
364 ],
365 },
366 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800367 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700368 "sizeEstimate": 42, # Estimated size in bytes of the message.
369 "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:
370 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700371 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700372 # - The Subject headers must match.
373 "labelIds": [ # List of IDs of labels applied to this message.
374 "A String",
375 ],
376 "id": "A String", # The immutable ID of the message.
377 }</pre>
378</div>
379
380<div class="method">
381 <code class="details" id="list">list(userId, labelIds=None, q=None, pageToken=None, maxResults=None, includeSpamTrash=None)</code>
382 <pre>Lists the messages in the user's mailbox.
383
384Args:
385 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
386 labelIds: string, Only return messages with labels that match all of the specified label IDs. (repeated)
387 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".
388 pageToken: string, Page token to retrieve a specific page of results in the list.
389 maxResults: integer, Maximum number of messages to return.
390 includeSpamTrash: boolean, Include messages from SPAM and TRASH in the results.
391
392Returns:
393 An object of the form:
394
395 {
396 "nextPageToken": "A String", # Token to retrieve the next page of results in the list.
397 "resultSizeEstimate": 42, # Estimated total number of results.
398 "messages": [ # List of messages.
399 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700400 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700401 "historyId": "A String", # The ID of the last history record that modified this message.
402 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
403 "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.
404 "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.
405 "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.
406 "size": 42, # Total number of bytes in the body of the message part.
407 },
408 "mimeType": "A String", # The MIME type of the message part.
409 "partId": "A String", # The immutable ID of the message part.
410 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
411 "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.
412 {
413 "name": "A String", # The name of the header before the : separator. For example, To.
414 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
415 },
416 ],
417 "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.
418 # Object with schema name: MessagePart
419 ],
420 },
421 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800422 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700423 "sizeEstimate": 42, # Estimated size in bytes of the message.
424 "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:
425 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700426 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700427 # - The Subject headers must match.
428 "labelIds": [ # List of IDs of labels applied to this message.
429 "A String",
430 ],
431 "id": "A String", # The immutable ID of the message.
432 },
433 ],
434 }</pre>
435</div>
436
437<div class="method">
438 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
439 <pre>Retrieves the next page of results.
440
441Args:
442 previous_request: The request for the previous page. (required)
443 previous_response: The response from the request for the previous page. (required)
444
445Returns:
446 A request object that you can call 'execute()' on to request the next
447 page. Returns None if there are no more items in the collection.
448 </pre>
449</div>
450
451<div class="method">
452 <code class="details" id="modify">modify(userId, id, body)</code>
453 <pre>Modifies the labels on the specified message.
454
455Args:
456 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
457 id: string, The ID of the message to modify. (required)
458 body: object, The request body. (required)
459 The object takes the form of:
460
461{
462 "removeLabelIds": [ # A list IDs of labels to remove from this message.
463 "A String",
464 ],
465 "addLabelIds": [ # A list of IDs of labels to add to this message.
466 "A String",
467 ],
468 }
469
470
471Returns:
472 An object of the form:
473
474 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700475 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700476 "historyId": "A String", # The ID of the last history record that modified this message.
477 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
478 "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.
479 "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.
480 "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.
481 "size": 42, # Total number of bytes in the body of the message part.
482 },
483 "mimeType": "A String", # The MIME type of the message part.
484 "partId": "A String", # The immutable ID of the message part.
485 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
486 "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.
487 {
488 "name": "A String", # The name of the header before the : separator. For example, To.
489 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
490 },
491 ],
492 "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.
493 # Object with schema name: MessagePart
494 ],
495 },
496 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800497 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700498 "sizeEstimate": 42, # Estimated size in bytes of the message.
499 "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:
500 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700501 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700502 # - The Subject headers must match.
503 "labelIds": [ # List of IDs of labels applied to this message.
504 "A String",
505 ],
506 "id": "A String", # The immutable ID of the message.
507 }</pre>
508</div>
509
510<div class="method">
511 <code class="details" id="send">send(userId, body=None, media_body=None)</code>
512 <pre>Sends the specified message to the recipients in the To, Cc, and Bcc headers.
513
514Args:
515 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
516 body: object, The request body.
517 The object takes the form of:
518
519{ # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700520 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700521 "historyId": "A String", # The ID of the last history record that modified this message.
522 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
523 "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.
524 "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.
525 "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.
526 "size": 42, # Total number of bytes in the body of the message part.
527 },
528 "mimeType": "A String", # The MIME type of the message part.
529 "partId": "A String", # The immutable ID of the message part.
530 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
531 "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.
532 {
533 "name": "A String", # The name of the header before the : separator. For example, To.
534 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
535 },
536 ],
537 "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.
538 # Object with schema name: MessagePart
539 ],
540 },
541 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800542 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700543 "sizeEstimate": 42, # Estimated size in bytes of the message.
544 "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:
545 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700546 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700547 # - The Subject headers must match.
548 "labelIds": [ # List of IDs of labels applied to this message.
549 "A String",
550 ],
551 "id": "A String", # The immutable ID of the message.
552}
553
554 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
555
556Returns:
557 An object of the form:
558
559 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700560 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700561 "historyId": "A String", # The ID of the last history record that modified this message.
562 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
563 "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.
564 "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.
565 "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.
566 "size": 42, # Total number of bytes in the body of the message part.
567 },
568 "mimeType": "A String", # The MIME type of the message part.
569 "partId": "A String", # The immutable ID of the message part.
570 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
571 "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.
572 {
573 "name": "A String", # The name of the header before the : separator. For example, To.
574 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
575 },
576 ],
577 "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.
578 # Object with schema name: MessagePart
579 ],
580 },
581 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800582 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700583 "sizeEstimate": 42, # Estimated size in bytes of the message.
584 "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:
585 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700586 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700587 # - The Subject headers must match.
588 "labelIds": [ # List of IDs of labels applied to this message.
589 "A String",
590 ],
591 "id": "A String", # The immutable ID of the message.
592 }</pre>
593</div>
594
595<div class="method">
596 <code class="details" id="trash">trash(userId, id)</code>
597 <pre>Moves the specified message to the trash.
598
599Args:
600 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
601 id: string, The ID of the message to Trash. (required)
602
603Returns:
604 An object of the form:
605
606 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700607 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700608 "historyId": "A String", # The ID of the last history record that modified this message.
609 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
610 "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.
611 "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.
612 "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.
613 "size": 42, # Total number of bytes in the body of the message part.
614 },
615 "mimeType": "A String", # The MIME type of the message part.
616 "partId": "A String", # The immutable ID of the message part.
617 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
618 "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.
619 {
620 "name": "A String", # The name of the header before the : separator. For example, To.
621 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
622 },
623 ],
624 "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.
625 # Object with schema name: MessagePart
626 ],
627 },
628 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800629 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700630 "sizeEstimate": 42, # Estimated size in bytes of the message.
631 "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:
632 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700633 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700634 # - The Subject headers must match.
635 "labelIds": [ # List of IDs of labels applied to this message.
636 "A String",
637 ],
638 "id": "A String", # The immutable ID of the message.
639 }</pre>
640</div>
641
642<div class="method">
643 <code class="details" id="untrash">untrash(userId, id)</code>
644 <pre>Removes the specified message from the trash.
645
646Args:
647 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
648 id: string, The ID of the message to remove from Trash. (required)
649
650Returns:
651 An object of the form:
652
653 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700654 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700655 "historyId": "A String", # The ID of the last history record that modified this message.
656 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
657 "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.
658 "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.
659 "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.
660 "size": 42, # Total number of bytes in the body of the message part.
661 },
662 "mimeType": "A String", # The MIME type of the message part.
663 "partId": "A String", # The immutable ID of the message part.
664 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
665 "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.
666 {
667 "name": "A String", # The name of the header before the : separator. For example, To.
668 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
669 },
670 ],
671 "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.
672 # Object with schema name: MessagePart
673 ],
674 },
675 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800676 "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.
Craig Citro065b5302014-08-14 00:47:23 -0700677 "sizeEstimate": 42, # Estimated size in bytes of the message.
678 "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:
679 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700680 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700681 # - The Subject headers must match.
682 "labelIds": [ # List of IDs of labels applied to this message.
683 "A String",
684 ],
685 "id": "A String", # The immutable ID of the message.
686 }</pre>
687</div>
688
689</body></html>