create_draft and retires the first one, so the user finds a single draft in their mail client rather than two.
The draft does not go to Trash. Afterwards get_draft and send_draft with the same id answer “Draft not found”. To change a draft rather than remove it, use update_draft.
Only unsent drafts can be deleted. Sent or received mail is refused whatever id is passed, so the tool cannot destroy real mail — use trash_emails for that. A draft that was moved to Trash is still a draft and can be deleted.
Parameters
The draft to delete, as returned by
create_draft, update_draft or list_drafts — edits do not change it — or a message id from search_emails with mailbox: "Drafts".Example
Call
Result
Errors
Every refusal ends withNothing was deleted., except a destroy the server left unanswered, where that cannot be asserted.
Draft not found: <id>.— the id does not resolve, or the draft was removed before the call reached it. Find drafts withlist_drafts.<id> is not a draft — it has already been sent or received…— the message is real mail. Read it withget_email.Another call is already working on <id>…— asend_draftor anotherdelete_draftfor this draft is running. Wait, then read the draft back withget_draft.An earlier send of <id> failed without saying whether the message went out.— check Sent before deciding.The server did not say whether <id> was deleted.— read it back withget_draftbefore retrying.The server refused to delete <id> (<type>).— the server answered the delete with an error of that type.