Send an email to one of your contacts with POST /v1/email-messages, then read your email history. It’s the same key, base URL and envelope as texts: copy a text send, post it to /v1/email-messages and add a subject. Emails go out from the mailboxes you connected in the app, with your business address and an unsubscribe link added at the bottom. A contact who unsubscribed isn’t emailed. Email is available on accounts that have it turned on; on any other account these calls answer 404. Test keys (rsms_test_) can read but can’t send.
#The Email object
idstring- The email’s id. Also returned as
message_id. Use it withGET /v1/email-messages/:id. channelstring- Always
email. directionenumoutboundfor what you sent,inboundfor a reply.from,tostring- Email addresses: your mailbox and the contact’s.
subjectstring | null- The subject line.
bodystring- The text you sent, before the footer.
statusenumqueued(not handed to the mailbox’s server yet),sent,bounced(the contact’s server sent it back),failed(refused before it left),unknown(it may have gone; Ready never resends it) orreceived(a reply from the contact).error_detailstring | null- Only on
failed,bouncedandunknown: the server’s explanation. contact_idinteger | null- The contact it belongs to.
created_at,sent_attimestamp- When it was created and when it was handed to the mailbox’s server.
#Send an email
Sends one email to a contact. Returns the Email object in data.
Parameters
tostring- The email address of one of your contacts. Send this or
contact_id, not both. An address no contact has answers404 contact_not_found: add the contact first. contact_idinteger- The contact to email, by id.
subjectstringRequired- The subject line.
bodystringRequired- The message, as plain text. Ready adds your business address and an unsubscribe link below it.
fromstring- The address of one of your connected mailboxes. Leave it out and Ready picks one.
Idempotency-Keystring, headerRecommended- Unique per send; reuse only to retry. A retry with the same key returns the first answer and sends nothing more.
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_request | Both or neither of to and contact_id, or no subject or body. |
| 400 | invalid_from | from isn’t one of your connected mailboxes. |
| 400 | no_email | The contact has no email address we can send to, or isn’t on your account. |
| 403 | recipient_unsubscribed | The contact unsubscribed from email. |
| 403 | email_paused | Sending is paused because too many recent emails bounced. |
| 404 | contact_not_found | No contact on your account has that address. |
| 409 | email_not_connected | No mailbox is connected on your account. |
| 409 | business_address_required | Your business address, which goes in every email’s footer, isn’t on file. |
| 429 | daily_limit_reached | Your mailboxes sent their daily limit. |
| 502 | send_unknown | We couldn’t confirm the email left. The answer carries its message_id. Don’t send it again; read it with GET /v1/email-messages/:id. |
Every refusal above except send_unknown happened before anything was sent, and isn’t stored under your Idempotency-Key, so you can fix the request and retry with the same key.
#Get an email
One email and its current status. Returns the Email object in data. An id that isn’t an email on your account answers 404 message_not_found.
#List emails
Your account’s sent emails and replies, newest first. Returns a list of Email objects in data, paged with a cursor.
Parameters
directionenum, queryinboundoroutbound.tostring, query- Only emails with this contact address, sent or received.
contact_idinteger, query- Only this contact’s emails.
statusstring, queryqueued,sent,bounced,failed,unknownorreceived. Any other word returns an empty list with awarningssentence.limitinteger, queryDefault50Max200- Page size.
before_idinteger, query- The
next_before_idfrom the previous page.
Returns
data[]object[]- Email objects.
has_moreboolean- Keep paging while
true. It’strueon an exactly full page, so the last page can be empty. next_before_idstring | null- Pass as
before_idfor the next page;nullon an empty page.
A reply from a contact also fires your inbound_reply webhook, with channel set to email.