Drafts
Unsent messages saved in the mailbox.
Drafts tools
| Tool | What it does |
|---|---|
| listDrafts | The drafts, most recently saved first, each with its subject, recipients and sender. query searches them. |
| getDraft | One draft in full: its sender, recipients, subject, the thread it replies to, its attachments and its body. |
| createDraft | Save a new draft without sending it. Every field is optional, and threadId makes it a reply. |
| updateDraft | Change fields on a draft. A field you leave out keeps its value, and a list replaces the saved one whole. |
| deleteDraft | Delete a draft for good. It does not go to the Bin. |
Reading needs “Read drafts” (drafts:read) and saving, changing or deleting needs “Create and edit drafts” (drafts:write). A client limited to some addresses sees only the drafts from them, and a draft it saves needs a from it may send as.
In the app’s chat, saving, changing and deleting a draft ask first unless you asked for them.
Reference
listDrafts
The unsent drafts in the mailbox, most recently saved first, each with its id, subject, recipients and sender. query searches the subject, the sender and the start of the body. When more follow, the last line gives a pageToken: call again with the same query and that pageToken.
Inputs
querystringlimitinteger- At least 1At most 100
pageTokenstring
Also available in
getDraft
One draft in full: its sender, recipients, subject, the thread it replies to, the names of its attachments and its body as saved. Take the id from listDrafts.
Inputs
draftIdstringRequired- Not empty
Also available in
createDraft
Save a new draft without sending it, as the composer does when you close it. Every field is optional, and html wins over text when both are given. from is the address it will be sent as, and threadId makes it a reply to that thread. sendEmail with the draft id sends it later.
Inputs
tostring[]ccstring[]bccstring[]subjectstring- Up to 998 characters
htmlstring- Up to 1000000 characters
textstring- Up to 1000000 characters
fromstringthreadIdstring
Also available in
updateDraft
Change fields on a saved draft. A field you leave out keeps its value, and a list you give replaces the saved one whole, so to with one address drops the others. from null clears the sender. Take the id from listDrafts.
Inputs
draftIdstringRequired- Not empty
tostring[]ccstring[]bccstring[]subjectstring- Up to 998 characters
htmlstring- Up to 1000000 characters
textstring- Up to 1000000 characters
fromstring- Can be null
threadIdstring
Also available in
deleteDraft
Delete a draft for good. It does not go to the Bin and cannot be brought back. Take the id from listDrafts.
Inputs
draftIdstringRequired- Not empty