Send an email from the CRM
POST /email_sends/actions/send
/email_sends/actions/sendSends an email from the user's connected Gmail mailbox to the given recipients, written from a contact, company or opportunity. The email is queued and leaves about 20 seconds later (10 seconds in which the user can still undo it plus 10 of grace), or later if the mailbox has reached its sending limit.
When to use: When the user has asked to send an email and has confirmed the final recipients, subject and text. Because it reaches other people and cannot be taken back once it leaves, confirm with the user before calling it.
When not to use: To prepare an email without sending it, use create_email_draft. To send at a given time, use schedule_email. To send a separate copy to each of several people, use send_email_batch. To send from an email campaign to an audience, use the campaign operations: this one is a personal 1-to-1 email from the user's own mailbox.
Side effects: The email goes out through the Gmail account of the chosen sender, as the user, to the recipients in to, cc and bcc. It is delivered asynchronously: this call only queues it and answers 202; the upload to Gmail happens in a background job, so read state with get_email_send to know when it is sent. Until release_at it can still be stopped with cancel_email_send. A copy synced from Gmail then appears in the email history of the record (copy_visible). A failed send notifies the user in the app. The email is limited to 12 per hour and 200 per day per mailbox; beyond that release_at moves later. If draft is given, the draft is deleted.
Filters: Optional unsubscribe link: include the unsubscribe block in body_html (see its description). Recipients who clicked such a link before are protected: the call answers 409 recipient_opted_out with their addresses until acknowledged_opt_outs lists them. Check beforehand with check_email_recipients.
Permissions: Requires a CRM seat and the crm.contacts_companies.write capability. 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 EmailSend resource
TypeScript Definitions
Use the request body type in TypeScript.
Email sends 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.
Sending and scheduling are two operations over the same use case (QueueEmailSend): send_email takes no
scheduled_at and schedule_email requires it. Both answer 202: the email is queued and the worker sends it.
The actions (cancel, send_now, retry, discard) take no body and answer the send as it is afterwards. A send
belongs to its author: for anyone else it answers 404 email_send_not_found.
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_sends/actions/send" \ -H "X-Auth-Token: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "idempotency_key": "0cd90e5a-2c03-4ab6-81a8-d48818026e58", "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", "attachment_ids": [ "string" ], "forwarded_attachment_ids": [ "string" ], "acknowledged_opt_outs": [ "string" ], "draft": "/entity/1", "replaces_send": "/entity/1" }'{ "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f", "state": "queued", "failure_reason": "rejected", "release_at": "2019-08-24T14:15:22Z", "scheduled_at": "2019-08-24T14:15:22Z", "sender_uuid": "6fd60e87-ecde-4069-8fdb-aebbacafea6d", "sender_address": "user@example.com", "contact": "/entity/1", "record": "/entity/1", "record_type": "contact", "record_name": "string", "mode": "compose", "subject": "string", "to": [ "string" ], "cc": [ "string" ], "bcc": [ "string" ], "recipients": [ {} ], "batch": "/entity/1", "created_at": "2019-08-24T14:15:22Z", "sent_at": "2019-08-24T14:15:22Z", "failed_at": "2019-08-24T14:15:22Z", "canceled_at": "2019-08-24T14:15:22Z", "cancellable": true, "retryable": true, "copy_visible": true}