Create an email draft
POST /email_drafts
/email_draftsSaves a new email draft for the user. Nothing is sent and nobody is notified; the user can open it in the app (Emails) and finish it, or you can send it later with send_email or schedule_email passing draft.
When to use: To prepare an email for the user to review before it goes out, or to keep a half-written one. This is the safe default when the user asks to write an email but has not said to send it.
When not to use: To send now, use send_email; to send at a given time, use schedule_email. To change a draft that already exists, use update_email_draft.
Side effects: Creates the draft with revision 1. Nothing leaves the mailbox. The attachments listed count against the CRM Files storage of the account until the draft is sent or deleted. A draft does not append the user's signature: paste it into body_html if you want it.
Filters: A draft is not checked like a send: it can have no recipients, no subject and no sender. Those are required when it is sent. A user can have at most 200 drafts.
Permissions: Requires a CRM seat and the crm.contacts_companies.write capability. Drafts are private: only their author can read or change them. The sender must be a mailbox the user can send from: one of their own or one shared with them (see list_email_senders). Writing from an opportunity also requires crm.opportunities.read and the Work level on its pipeline.
Value for the X-Auth-Token header parameter.
In: header
The new EmailDraft resource
TypeScript Definitions
Use the request body type in TypeScript.
Email drafts of the public API (fase 5). Generated from the proposal by fase-5/tools/gen_email_sending_api.py; the
texts are the proposal's. Every operation checks the CRM access in its provider or processor before anything else,
because API Platform evaluates security after the provider.
A draft belongs to its author: for anyone else it answers 404 email_draft_not_found. create_email_draft and
update_email_draft answer without body_html (the panel's use case returns the draft without its body, so that an
autosave never echoes megabytes); get_email_draft has it.
Response Body
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
curl -X POST "https://api.easymailing.com/email_drafts" \ -H "X-Auth-Token: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "sender_uuid": "6fd60e87-ecde-4069-8fdb-aebbacafea6d", "record": "/entity/1", "mode": "compose", "source_email": "/entity/1", "to": [ "string" ], "cc": [ "string" ], "bcc": [ "string" ], "subject": "string", "body_html": "string", "forwarded_attachment_ids": [ "string" ], "attachment_ids": [ "string" ] }'{ "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f", "revision": 0, "sender_uuid": "6fd60e87-ecde-4069-8fdb-aebbacafea6d", "record": "/entity/1", "record_type": "contact", "record_name": "string", "mode": "compose", "source_email": "/entity/1", "to": [ "string" ], "cc": [ "string" ], "bcc": [ "string" ], "subject": "string", "forwarded_attachment_ids": [ "string" ], "attachments": [ {} ], "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z"}