blob: a514067d8af9c0a80379b0535e9d5ea15dc265c9 [file] [log] [blame]
Craig Citro065b5302014-08-14 00:47:23 -07001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="gmail_v1.html">Gmail API</a> . <a href="gmail_v1.users.html">users</a> . <a href="gmail_v1.users.messages.html">messages</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="gmail_v1.users.messages.attachments.html">attachments()</a></code>
79</p>
80<p class="firstline">Returns the attachments Resource.</p>
81
82<p class="toc_element">
83 <code><a href="#delete">delete(userId, id)</a></code></p>
84<p class="firstline">Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.</p>
85<p class="toc_element">
Craig Citro0e5b9bf2014-10-15 10:26:14 -070086 <code><a href="#get">get(userId, id, format=None, metadataHeaders=None)</a></code></p>
Craig Citro065b5302014-08-14 00:47:23 -070087<p class="firstline">Gets the specified message.</p>
88<p class="toc_element">
Craig Citroe633be12015-03-02 13:40:36 -080089 <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 -070090<p class="firstline">Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. Does not send a message.</p>
Craig Citro065b5302014-08-14 00:47:23 -070091<p class="toc_element">
Nathaniel Manista4f877e52015-06-15 16:44:50 +000092 <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 -070093<p class="firstline">Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.</p>
Craig Citro065b5302014-08-14 00:47:23 -070094<p class="toc_element">
95 <code><a href="#list">list(userId, labelIds=None, q=None, pageToken=None, maxResults=None, includeSpamTrash=None)</a></code></p>
96<p class="firstline">Lists the messages in the user's mailbox.</p>
97<p class="toc_element">
98 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
99<p class="firstline">Retrieves the next page of results.</p>
100<p class="toc_element">
101 <code><a href="#modify">modify(userId, id, body)</a></code></p>
102<p class="firstline">Modifies the labels on the specified message.</p>
103<p class="toc_element">
104 <code><a href="#send">send(userId, body=None, media_body=None)</a></code></p>
105<p class="firstline">Sends the specified message to the recipients in the To, Cc, and Bcc headers.</p>
106<p class="toc_element">
107 <code><a href="#trash">trash(userId, id)</a></code></p>
108<p class="firstline">Moves the specified message to the trash.</p>
109<p class="toc_element">
110 <code><a href="#untrash">untrash(userId, id)</a></code></p>
111<p class="firstline">Removes the specified message from the trash.</p>
112<h3>Method Details</h3>
113<div class="method">
114 <code class="details" id="delete">delete(userId, id)</code>
115 <pre>Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.
116
117Args:
118 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
119 id: string, The ID of the message to delete. (required)
120</pre>
121</div>
122
123<div class="method">
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700124 <code class="details" id="get">get(userId, id, format=None, metadataHeaders=None)</code>
Craig Citro065b5302014-08-14 00:47:23 -0700125 <pre>Gets the specified message.
126
127Args:
128 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
129 id: string, The ID of the message to retrieve. (required)
130 format: string, The format to return the message in.
131 Allowed values
132 full -
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700133 metadata -
Craig Citro065b5302014-08-14 00:47:23 -0700134 minimal -
135 raw -
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700136 metadataHeaders: string, When given and format is METADATA, only include headers specified. (repeated)
Craig Citro065b5302014-08-14 00:47:23 -0700137
138Returns:
139 An object of the form:
140
141 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700142 "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 -0700143 "historyId": "A String", # The ID of the last history record that modified this message.
144 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
145 "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.
146 "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.
147 "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.
148 "size": 42, # Total number of bytes in the body of the message part.
149 },
150 "mimeType": "A String", # The MIME type of the message part.
151 "partId": "A String", # The immutable ID of the message part.
152 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
153 "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.
154 {
155 "name": "A String", # The name of the header before the : separator. For example, To.
156 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
157 },
158 ],
159 "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.
160 # Object with schema name: MessagePart
161 ],
162 },
163 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800164 "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 -0700165 "sizeEstimate": 42, # Estimated size in bytes of the message.
166 "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:
167 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700168 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700169 # - The Subject headers must match.
170 "labelIds": [ # List of IDs of labels applied to this message.
171 "A String",
172 ],
173 "id": "A String", # The immutable ID of the message.
174 }</pre>
175</div>
176
177<div class="method">
Craig Citroe633be12015-03-02 13:40:36 -0800178 <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 -0700179 <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 -0700180
181Args:
182 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
183 body: object, The request body.
184 The object takes the form of:
185
186{ # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700187 "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 -0700188 "historyId": "A String", # The ID of the last history record that modified this message.
189 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
190 "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.
191 "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.
192 "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.
193 "size": 42, # Total number of bytes in the body of the message part.
194 },
195 "mimeType": "A String", # The MIME type of the message part.
196 "partId": "A String", # The immutable ID of the message part.
197 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
198 "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.
199 {
200 "name": "A String", # The name of the header before the : separator. For example, To.
201 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
202 },
203 ],
204 "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.
205 # Object with schema name: MessagePart
206 ],
207 },
208 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800209 "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 -0700210 "sizeEstimate": 42, # Estimated size in bytes of the message.
211 "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:
212 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700213 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700214 # - The Subject headers must match.
215 "labelIds": [ # List of IDs of labels applied to this message.
216 "A String",
217 ],
218 "id": "A String", # The immutable ID of the message.
219}
220
221 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700222 internalDateSource: string, Source for Gmail's internal date of the message.
223 Allowed values
224 dateHeader -
225 receivedTime -
Craig Citroe633be12015-03-02 13:40:36 -0800226 neverMarkSpam: boolean, Ignore the Gmail spam classifier decision and never mark this email as SPAM in the mailbox.
227 processForCalendar: boolean, Process calendar invites in the email and add any extracted meetings to the Google Calendar for this user.
228 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 -0700229
230Returns:
231 An object of the form:
232
233 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700234 "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 -0700235 "historyId": "A String", # The ID of the last history record that modified this message.
236 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
237 "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.
238 "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.
239 "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.
240 "size": 42, # Total number of bytes in the body of the message part.
241 },
242 "mimeType": "A String", # The MIME type of the message part.
243 "partId": "A String", # The immutable ID of the message part.
244 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
245 "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.
246 {
247 "name": "A String", # The name of the header before the : separator. For example, To.
248 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
249 },
250 ],
251 "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.
252 # Object with schema name: MessagePart
253 ],
254 },
255 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800256 "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 -0700257 "sizeEstimate": 42, # Estimated size in bytes of the message.
258 "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:
259 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700260 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700261 # - The Subject headers must match.
262 "labelIds": [ # List of IDs of labels applied to this message.
263 "A String",
264 ],
265 "id": "A String", # The immutable ID of the message.
266 }</pre>
267</div>
268
269<div class="method">
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000270 <code class="details" id="insert">insert(userId, body=None, media_body=None, internalDateSource=None, deleted=None)</code>
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700271 <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 -0700272
273Args:
274 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
275 body: object, The request body.
276 The object takes the form of:
277
278{ # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700279 "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 -0700280 "historyId": "A String", # The ID of the last history record that modified this message.
281 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
282 "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.
283 "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.
284 "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.
285 "size": 42, # Total number of bytes in the body of the message part.
286 },
287 "mimeType": "A String", # The MIME type of the message part.
288 "partId": "A String", # The immutable ID of the message part.
289 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
290 "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.
291 {
292 "name": "A String", # The name of the header before the : separator. For example, To.
293 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
294 },
295 ],
296 "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.
297 # Object with schema name: MessagePart
298 ],
299 },
300 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800301 "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 -0700302 "sizeEstimate": 42, # Estimated size in bytes of the message.
303 "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:
304 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700305 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700306 # - The Subject headers must match.
307 "labelIds": [ # List of IDs of labels applied to this message.
308 "A String",
309 ],
310 "id": "A String", # The immutable ID of the message.
311}
312
313 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700314 internalDateSource: string, Source for Gmail's internal date of the message.
315 Allowed values
316 dateHeader -
317 receivedTime -
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000318 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 -0700319
320Returns:
321 An object of the form:
322
323 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700324 "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 -0700325 "historyId": "A String", # The ID of the last history record that modified this message.
326 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
327 "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.
328 "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.
329 "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.
330 "size": 42, # Total number of bytes in the body of the message part.
331 },
332 "mimeType": "A String", # The MIME type of the message part.
333 "partId": "A String", # The immutable ID of the message part.
334 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
335 "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.
336 {
337 "name": "A String", # The name of the header before the : separator. For example, To.
338 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
339 },
340 ],
341 "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.
342 # Object with schema name: MessagePart
343 ],
344 },
345 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800346 "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 -0700347 "sizeEstimate": 42, # Estimated size in bytes of the message.
348 "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:
349 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700350 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700351 # - The Subject headers must match.
352 "labelIds": [ # List of IDs of labels applied to this message.
353 "A String",
354 ],
355 "id": "A String", # The immutable ID of the message.
356 }</pre>
357</div>
358
359<div class="method">
360 <code class="details" id="list">list(userId, labelIds=None, q=None, pageToken=None, maxResults=None, includeSpamTrash=None)</code>
361 <pre>Lists the messages in the user's mailbox.
362
363Args:
364 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
365 labelIds: string, Only return messages with labels that match all of the specified label IDs. (repeated)
366 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".
367 pageToken: string, Page token to retrieve a specific page of results in the list.
368 maxResults: integer, Maximum number of messages to return.
369 includeSpamTrash: boolean, Include messages from SPAM and TRASH in the results.
370
371Returns:
372 An object of the form:
373
374 {
375 "nextPageToken": "A String", # Token to retrieve the next page of results in the list.
376 "resultSizeEstimate": 42, # Estimated total number of results.
377 "messages": [ # List of messages.
378 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700379 "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 -0700380 "historyId": "A String", # The ID of the last history record that modified this message.
381 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
382 "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.
383 "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.
384 "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.
385 "size": 42, # Total number of bytes in the body of the message part.
386 },
387 "mimeType": "A String", # The MIME type of the message part.
388 "partId": "A String", # The immutable ID of the message part.
389 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
390 "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.
391 {
392 "name": "A String", # The name of the header before the : separator. For example, To.
393 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
394 },
395 ],
396 "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.
397 # Object with schema name: MessagePart
398 ],
399 },
400 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800401 "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 -0700402 "sizeEstimate": 42, # Estimated size in bytes of the message.
403 "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:
404 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700405 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700406 # - The Subject headers must match.
407 "labelIds": [ # List of IDs of labels applied to this message.
408 "A String",
409 ],
410 "id": "A String", # The immutable ID of the message.
411 },
412 ],
413 }</pre>
414</div>
415
416<div class="method">
417 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
418 <pre>Retrieves the next page of results.
419
420Args:
421 previous_request: The request for the previous page. (required)
422 previous_response: The response from the request for the previous page. (required)
423
424Returns:
425 A request object that you can call 'execute()' on to request the next
426 page. Returns None if there are no more items in the collection.
427 </pre>
428</div>
429
430<div class="method">
431 <code class="details" id="modify">modify(userId, id, body)</code>
432 <pre>Modifies the labels on the specified message.
433
434Args:
435 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
436 id: string, The ID of the message to modify. (required)
437 body: object, The request body. (required)
438 The object takes the form of:
439
440{
441 "removeLabelIds": [ # A list IDs of labels to remove from this message.
442 "A String",
443 ],
444 "addLabelIds": [ # A list of IDs of labels to add to this message.
445 "A String",
446 ],
447 }
448
449
450Returns:
451 An object of the form:
452
453 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700454 "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 -0700455 "historyId": "A String", # The ID of the last history record that modified this message.
456 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
457 "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.
458 "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.
459 "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.
460 "size": 42, # Total number of bytes in the body of the message part.
461 },
462 "mimeType": "A String", # The MIME type of the message part.
463 "partId": "A String", # The immutable ID of the message part.
464 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
465 "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.
466 {
467 "name": "A String", # The name of the header before the : separator. For example, To.
468 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
469 },
470 ],
471 "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.
472 # Object with schema name: MessagePart
473 ],
474 },
475 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800476 "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 -0700477 "sizeEstimate": 42, # Estimated size in bytes of the message.
478 "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:
479 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700480 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700481 # - The Subject headers must match.
482 "labelIds": [ # List of IDs of labels applied to this message.
483 "A String",
484 ],
485 "id": "A String", # The immutable ID of the message.
486 }</pre>
487</div>
488
489<div class="method">
490 <code class="details" id="send">send(userId, body=None, media_body=None)</code>
491 <pre>Sends the specified message to the recipients in the To, Cc, and Bcc headers.
492
493Args:
494 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
495 body: object, The request body.
496 The object takes the form of:
497
498{ # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700499 "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 -0700500 "historyId": "A String", # The ID of the last history record that modified this message.
501 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
502 "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.
503 "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.
504 "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.
505 "size": 42, # Total number of bytes in the body of the message part.
506 },
507 "mimeType": "A String", # The MIME type of the message part.
508 "partId": "A String", # The immutable ID of the message part.
509 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
510 "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.
511 {
512 "name": "A String", # The name of the header before the : separator. For example, To.
513 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
514 },
515 ],
516 "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.
517 # Object with schema name: MessagePart
518 ],
519 },
520 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800521 "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 -0700522 "sizeEstimate": 42, # Estimated size in bytes of the message.
523 "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:
524 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700525 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700526 # - The Subject headers must match.
527 "labelIds": [ # List of IDs of labels applied to this message.
528 "A String",
529 ],
530 "id": "A String", # The immutable ID of the message.
531}
532
533 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
534
535Returns:
536 An object of the form:
537
538 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700539 "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 -0700540 "historyId": "A String", # The ID of the last history record that modified this message.
541 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
542 "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.
543 "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.
544 "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.
545 "size": 42, # Total number of bytes in the body of the message part.
546 },
547 "mimeType": "A String", # The MIME type of the message part.
548 "partId": "A String", # The immutable ID of the message part.
549 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
550 "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.
551 {
552 "name": "A String", # The name of the header before the : separator. For example, To.
553 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
554 },
555 ],
556 "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.
557 # Object with schema name: MessagePart
558 ],
559 },
560 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800561 "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 -0700562 "sizeEstimate": 42, # Estimated size in bytes of the message.
563 "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:
564 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700565 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700566 # - The Subject headers must match.
567 "labelIds": [ # List of IDs of labels applied to this message.
568 "A String",
569 ],
570 "id": "A String", # The immutable ID of the message.
571 }</pre>
572</div>
573
574<div class="method">
575 <code class="details" id="trash">trash(userId, id)</code>
576 <pre>Moves the specified message to the trash.
577
578Args:
579 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
580 id: string, The ID of the message to Trash. (required)
581
582Returns:
583 An object of the form:
584
585 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700586 "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 -0700587 "historyId": "A String", # The ID of the last history record that modified this message.
588 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
589 "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.
590 "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.
591 "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.
592 "size": 42, # Total number of bytes in the body of the message part.
593 },
594 "mimeType": "A String", # The MIME type of the message part.
595 "partId": "A String", # The immutable ID of the message part.
596 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
597 "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.
598 {
599 "name": "A String", # The name of the header before the : separator. For example, To.
600 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
601 },
602 ],
603 "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.
604 # Object with schema name: MessagePart
605 ],
606 },
607 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800608 "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 -0700609 "sizeEstimate": 42, # Estimated size in bytes of the message.
610 "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:
611 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700612 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700613 # - The Subject headers must match.
614 "labelIds": [ # List of IDs of labels applied to this message.
615 "A String",
616 ],
617 "id": "A String", # The immutable ID of the message.
618 }</pre>
619</div>
620
621<div class="method">
622 <code class="details" id="untrash">untrash(userId, id)</code>
623 <pre>Removes the specified message from the trash.
624
625Args:
626 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required)
627 id: string, The ID of the message to remove from Trash. (required)
628
629Returns:
630 An object of the form:
631
632 { # An email message.
Takashi Matsuo06694102015-09-11 13:55:40 -0700633 "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 -0700634 "historyId": "A String", # The ID of the last history record that modified this message.
635 "payload": { # A single MIME message part. # The parsed email structure in the message parts.
636 "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.
637 "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.
638 "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.
639 "size": 42, # Total number of bytes in the body of the message part.
640 },
641 "mimeType": "A String", # The MIME type of the message part.
642 "partId": "A String", # The immutable ID of the message part.
643 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment.
644 "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.
645 {
646 "name": "A String", # The name of the header before the : separator. For example, To.
647 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com.
648 },
649 ],
650 "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.
651 # Object with schema name: MessagePart
652 ],
653 },
654 "snippet": "A String", # A short part of the message text.
Craig Citroe633be12015-03-02 13:40:36 -0800655 "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 -0700656 "sizeEstimate": 42, # Estimated size in bytes of the message.
657 "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:
658 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request.
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700659 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
Craig Citro065b5302014-08-14 00:47:23 -0700660 # - The Subject headers must match.
661 "labelIds": [ # List of IDs of labels applied to this message.
662 "A String",
663 ],
664 "id": "A String", # The immutable ID of the message.
665 }</pre>
666</div>
667
668</body></html>