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, threadId makes it a reply, and forwardOf with it forwards a message of that thread. |
| 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
- API
GET /drafts- TypeScript
nextmail.drafts.list()nextmail.drafts.listAll()nextmail.drafts.iterate()- Python
drafts.list()drafts.list_all()drafts.iterate()- Ruby
drafts.listdrafts.list_alldrafts.iterate- PHP
drafts->listdrafts->listAlldrafts->iterate- Go
Drafts.ListDrafts.ListAllDrafts.Iterate- Java
drafts().listdrafts().listAlldrafts().iterate- C#
Drafts.ListAsyncDrafts.ListAllAsyncDrafts.IterateAsync
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
- API
GET /drafts/{id}- TypeScript
nextmail.drafts.get()- Python
drafts.get()- Ruby
drafts.get- PHP
drafts->get- Go
Drafts.Get- Java
drafts().get- C#
Drafts.GetAsync
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. To forward an email, pass threadId and forwardOf, the id of the message in it: the draft takes the names of its files and a "Fwd:" subject unless you give one, and sending it quotes the message below what you wrote and attaches its files. 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
fromstringthreadIdstringforwardOfstringTo forward an email: the id of the message in threadId, from getThread. Needs threadId.
1 to 998 characters
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
Also available in
- API
DELETE /drafts/{id}- TypeScript
nextmail.drafts.delete()- Python
drafts.delete()- Ruby
drafts.delete- PHP
drafts->delete- Go
Drafts.Delete- Java
drafts().delete- C#
Drafts.DeleteAsync
Google Workspace