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.

POSThttps://g.sendcorex.com/v1command: send_email

queued: 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[]required

    Recipient address, or an array of up to 30 addresses (paid plans). With unsubscribe: true each person gets their own copy; without it, everyone in to and cc sees each other.

  • to_namestringoptional

    Recipient name. Defaults to the part before the @.

  • subjectstringrequired

    Email subject.

  • htmlstringoptional

    HTML body. Send html or text.

  • textstringoptional

    Plain text body. It is converted to HTML with <br>.

  • ccstring[]optional

    Visible copies. to + cc + bcc up to 50 addresses.

  • bccstring[]optional

    Hidden copies. They never appear in the headers.

  • template_idstringoptional

    Fill the body (and an empty subject) from a template. Placeholders use to_name and variables.

  • variablesobjectoptional

    Your own template placeholders: { "company": "Acme" } fills {company}.

  • attachmentsobject[]optional

    Files: [{ file_name, content, content_type }], content in base64. Up to 20 files, 25 MB in total. Every file is scanned.

  • compose_uidstringoptional

    Attachments uploaded before with upload_attachment.

  • attachment_idsstring[]optional

    Which uploaded attachments to send. Without it, all of them.

  • followup_atstringoptional

    Remind you if nobody replies by this date (RFC 3339, YYYY-MM-DD or epoch ms).

  • labelstringoptional

    A label to put on the sent message. It becomes labels: [label].

  • track_opensbooleanoptional

    Track when each recipient opens the email (invisible pixel). Default true.

  • track_clicksbooleanoptional

    Track clicks on the links (each link goes through a redirect). Default true.

  • unsubscribebooleanoptional

    Add an unsubscribe link. Put [unsubscribe] in the body (as a link href or as plain text) where the link should go; without it, a default line is added at the end. Default false.

  • idempotency_keystringoptional

    Your 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 with idempotent_replayed: true, and nothing is sent again.

  • audiencestringoptional

    Send to an audience instead of addresses: subscribed, opened, clicked, both, seg:<segment_id> or msg:<message_uid>:opened|clicked|not_opened. to becomes 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_uid

    The id of the sent message. It appears in Sent immediately.

  • thread_id

    The conversation of the new message.

  • message_id

    A provisional Message-ID. The real SMTP one replaces it shortly after.

  • recipients

    How many copies were queued (to + cc + bcc), 1 credit each.

  • queued

    true = saved and queued for delivery. It does not mean delivered.

  • idempotent_replayed

    Only on a retry: true when this is the stored result of an earlier call with the same idempotency_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.

  • 401TOKEN_EXPIRED

    The access token has expired. Call Refresh Token and repeat the request.

  • 401INVALID_TOKEN

    The token is malformed, unknown or revoked.

  • 429RATE_LIMITED

    More than 15 requests/s or 15 in flight for the same IP + mailbox. Wait the number of seconds in Retry-After.

  • CMDINVALID_IDEMPOTENCY_KEY

    `idempotency_key` must have 1–255 characters: letters, numbers, `_ - : .`.

  • CMDIDEMPOTENCY_KEY_REUSED

    This `idempotency_key` was already used with different args. Use a new key for every new email.

  • CMDIDEMPOTENCY_IN_PROGRESS

    A call with the same `idempotency_key` is still running. Try again in 1 second with the same key.

  • CMDINVALID_AUDIENCE

    The audience is not valid: unknown group, a segment of another mailbox or a message this mailbox didn’t send.

  • CMDAUDIENCE_OVER_LIMIT

    The 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.

  • CMDEMPTY_AUDIENCE

    Nobody in this audience right now.

  • CMDRECIPIENT_UNSUBSCRIBED

    One or more recipients unsubscribed from this mailbox. `recipients` lists them: remove them or send again with `unsubscribe: false`.

  • CMDPAID_PLAN_REQUIRED

    More than one address in `to` needs a paid plan.

  • CMDTOO_MANY_RECIPIENTS

    `to` has more than 30 addresses.

  • CMDINVALID_ARGS

    A required argument is missing or invalid.

  • CMDINVALID_TOADDRESS

    The to address is not a valid email.

  • CMDINVALID_CCADDRESS

    One of the cc addresses is not a valid email.

  • CMDINVALID_BCCADDRESS

    One of the bcc addresses is not a valid email.

  • CMDRECIPIENT_LIMIT_EXCEEDED

    to, cc and bcc together have more than 50 addresses.

  • CMDINVALID_ATTACHMENT

    An attachment content is not valid base64.

  • CMDFILE_BLOCKED

    A file was blocked by the security scan.

  • CMDATTACHMENTS_TOO_LARGE

    The attachments of the email add up to more than 25 MB, or the mailbox already has 500 MB of uploads waiting to be sent.

  • CMDATTACHMENT_MISSING

    An 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.

  • CMDNO_CREDITS

    The account has fewer email credits than recipients (1 credit per copy).

  • CMDSENDER_NOT_FOUND

    The sender behind the token is not registered.

  • CMDSENDER_NO_DOMAIN

    The sender behind the token has no domain.

  • CMDINTERNAL

    Server error. The detail is only written to the server log.