Receive Emails: Send & trust
Send Email
Send a new email from the sender behind your token. The message is saved to Sent right away and delivered in the background.
https://g.sendcorex.com/v1command: send_emailqueued: true means saved and waiting in the queue, not delivered. The message_id in the response is provisional: the real SMTP Message-ID replaces it a few seconds later and shows up in get_messages.
Each recipient (to + cc + bcc) gets their own copy and uses 1 credit. Bcc addresses never appear in the headers. The body is limited to 2 MB, attachments to 25 MB in total.
Recipients who refused tracking on the preferences page are never tracked, even with true.
Emails sent from the mailbox carry no List-Unsubscribe header or unsubscribe link unless you send unsubscribe: true, because they are personal emails.
Everyone who receives an email from the mailbox becomes a contact in the account’s “Webmail” list and is trusted in this mailbox: their replies go to the Inbox and the address shows up in autocomplete. Senders the mailbox blocked stay blocked.
With unsubscribe: true, recipients who already unsubscribed from this mailbox are refused with RECIPIENT_UNSUBSCRIBED, and recipients lists them. Replies are never blocked.
Arguments
tostring | string[]requiredRecipient address, or an array of up to 30 addresses (paid plans). With
unsubscribe: trueeach person gets their own copy; without it, everyone intoandccsees each other.to_namestringoptionalRecipient name. Defaults to the part before the
@.subjectstringrequiredEmail subject.
htmlstringoptionalHTML body. Send
htmlortext.textstringoptionalPlain text body. It is converted to HTML with
<br>.ccstring[]optionalVisible copies. to + cc + bcc up to 50 addresses.
bccstring[]optionalHidden copies. They never appear in the headers.
template_idstringoptionalFill the body (and an empty subject) from a template. Placeholders use
to_nameandvariables.variablesobjectoptionalYour own template placeholders:
{ "company": "Acme" }fills{company}.attachmentsobject[]optionalFiles:
[{ file_name, content, content_type }],contentin base64. Up to 20 files, 25 MB in total. Every file is scanned.compose_uidstringoptionalAttachments uploaded before with
upload_attachment.attachment_idsstring[]optionalWhich uploaded attachments to send. Without it, all of them.
followup_atstringoptionalRemind you if nobody replies by this date (RFC 3339,
YYYY-MM-DDor epoch ms).labelstringoptionalA label to put on the sent message. It becomes
labels: [label].track_opensbooleanoptionalTrack when each recipient opens the email (invisible pixel). Default
true.track_clicksbooleanoptionalTrack clicks on the links (each link goes through a redirect). Default
true.unsubscribebooleanoptionalAdd an unsubscribe link. Put
[unsubscribe]in the body (as a linkhrefor as plain text) where the link should go; without it, a default line is added at the end. Defaultfalse.idempotency_keystringoptionalYour own key for this email (1–255 characters: letters, numbers,
_ - : .), valid for 24 hours. A retry with the same key and the same args returns the first result withidempotent_replayed: true, and nothing is sent again.audiencestringoptionalSend to an audience instead of addresses:
subscribed,opened,clicked,both,seg:<segment_id>ormsg:<message_uid>:opened|clicked|not_opened.tobecomes optional. Up to 5,000 people. The unsubscribe link is turned on and the email goes out as marketing. Paid plans.
Retrying? Use an idempotency key so the email is never sent twice. Idempotency →
Quick start
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1',
{
commands: [
{
command: "send_email",
args: {
to: "client@example.com",
to_name: "Client",
cc: [
"manager@example.com"
],
subject: "Quote",
html: "<p>Here is the quote.</p>",
attachments: [
{
file_name: "quote.pdf",
content: "JVBERi0xLjcKJcfsj6IK…",
content_type: "application/pdf"
}
],
followup_at: "2026-10-29T09:00:00+08:00",
label: "sales"
}
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_TOKEN } },
);
const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);Response
{
"type": "SUCCESS",
"results": [
{
"command": "send_email",
"id": "0",
"type": "SUCCESS",
"data": {
"message_uid": "Vj0xQUJDMTIz",
"thread_id": "thr_9a1c4e72",
"message_id": "<5e0b9c1a-3d7f-4a21-9a6e-2f1c8d4b7e90>",
"recipients": 2,
"queued": true
}
}
]
}Response fields
message_uidThe id of the sent message. It appears in
Sentimmediately.thread_idThe conversation of the new message.
message_idA provisional Message-ID. The real SMTP one replaces it shortly after.
recipientsHow many copies were queued (to + cc + bcc), 1 credit each.
queuedtrue= saved and queued for delivery. It does not mean delivered.idempotent_replayedOnly on a retry:
truewhen this is the stored result of an earlier call with the sameidempotency_key. Nothing was sent again.
Repeated sends
The same write (same args) repeated within 1.5 seconds returns the first result instead of sending again. A polling loop that sends the same email twice does not duplicate it.
Safe retries
Always send an idempotency_key (for example a UUID per email). If a call times out, retry with the same key: the email is never sent twice. Only a successful send is stored, so if the send failed, a retry with the same key runs again. Keys are per mailbox: the same key in another mailbox or in POST /v3.0/send does not conflict.
Request body
{
"commands": [
{
"command": "send_email",
"args": {
"idempotency_key": "order-1234-confirmation",
"to": "ana@example.com",
"subject": "Your order",
"html": "<p>Thanks!</p>"
}
}
]
}Errors
HTTP-level errors return type, code and message. Errors marked CMD come back inside the command result, with HTTP 200.
- 401
TOKEN_EXPIREDThe access token has expired. Call Refresh Token and repeat the request.
- 401
INVALID_TOKENThe token is malformed, unknown or revoked.
- 429
RATE_LIMITEDMore than 15 requests/s or 15 in flight for the same IP + mailbox. Wait the number of seconds in Retry-After.
- CMD
INVALID_IDEMPOTENCY_KEY`idempotency_key` must have 1–255 characters: letters, numbers, `_ - : .`.
- CMD
IDEMPOTENCY_KEY_REUSEDThis `idempotency_key` was already used with different args. Use a new key for every new email.
- CMD
IDEMPOTENCY_IN_PROGRESSA call with the same `idempotency_key` is still running. Try again in 1 second with the same key.
- CMD
INVALID_AUDIENCEThe audience is not valid: unknown group, a segment of another mailbox or a message this mailbox didn’t send.
- CMD
AUDIENCE_OVER_LIMITThe audience has more people than you can send to (up to 5,000 per email and your daily limit). `total` and `allowed` say how many.
- CMD
EMPTY_AUDIENCENobody in this audience right now.
- CMD
RECIPIENT_UNSUBSCRIBEDOne or more recipients unsubscribed from this mailbox. `recipients` lists them: remove them or send again with `unsubscribe: false`.
- CMD
PAID_PLAN_REQUIREDMore than one address in `to` needs a paid plan.
- CMD
TOO_MANY_RECIPIENTS`to` has more than 30 addresses.
- CMD
INVALID_ARGSA required argument is missing or invalid.
- CMD
INVALID_TOADDRESSThe to address is not a valid email.
- CMD
INVALID_CCADDRESSOne of the cc addresses is not a valid email.
- CMD
INVALID_BCCADDRESSOne of the bcc addresses is not a valid email.
- CMD
RECIPIENT_LIMIT_EXCEEDEDto, cc and bcc together have more than 50 addresses.
- CMD
INVALID_ATTACHMENTAn attachment content is not valid base64.
- CMD
FILE_BLOCKEDA file was blocked by the security scan.
- CMD
ATTACHMENTS_TOO_LARGEThe attachments of the email add up to more than 25 MB, or the mailbox already has 500 MB of uploads waiting to be sent.
- CMD
ATTACHMENT_MISSINGAn uploaded attachment no longer exists (uploads not sent within 48 hours, and not used by a draft or scheduled email, are deleted). Upload it again.
- CMD
NO_CREDITSThe account has fewer email credits than recipients (1 credit per copy).
- CMD
SENDER_NOT_FOUNDThe sender behind the token is not registered.
- CMD
SENDER_NO_DOMAINThe sender behind the token has no domain.
- CMD
INTERNALServer error. The detail is only written to the server log.