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.
Attachments are not supported yet. The body is limited to 2 MB. cc and bcc are accepted but are not active in the beta version.
Arguments
tostringrequiredRecipient email address. One address.
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[]optionalUp to 50 addresses. Not active in the beta version.
bccstring[]optionalUp to 50 addresses. Not active in the beta version.
labelstringoptionalA label to put on the sent message. It becomes
labels: [label].
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",
subject: "Quote",
html: "<p>Here is the quote.</p>",
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>",
"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.
queuedtrue= saved and queued for delivery. It does not mean delivered.
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.
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_ARGSA required argument is missing or invalid.
- CMD
NO_CREDITSThe account has no email credits left.
- 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.