Receive Emails: Drafts
Send Draft
Send a saved draft now, through the same checks as send_email, reply and forward.
https://g.sendcorex.com/v1command: send_draftThis really sends the email. Credits, the daily limit and the anti-spam check run like in any other send.
The draft is deleted only after the send is accepted. If the send is refused, the draft stays in Drafts and the error message ends with "The draft was kept."
A forward draft goes with the "Forwarded message" block of the original. If the body already has the block (drafts written in the webmail), it is not added twice.
Arguments
idstringrequiredThe
draft_id.
Quick start
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1',
{
commands: [
{
command: "send_draft",
args: {
id: "Vj0xRFJBRlQx"
}
}
]
},
{ 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_draft",
"id": "0",
"type": "SUCCESS",
"data": {
"message_uid": "Vj0xQUJDMTIz",
"thread_id": "thr_9a1c4e72",
"message_id": "5e0b9c1a-3d7f-4a21-9a6e-2f1c8d4b7e90",
"recipients": 1,
"queued": true
}
}
]
}Response fields
message_uidThe sent email, now in Sent. Same result as send_email.
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
RECIPIENT_UNSUBSCRIBEDOne or more recipients unsubscribed from this mailbox. `recipients` lists them: remove them or send again with `unsubscribe: false`.
- CMD
INVALID_ARGSA required argument is missing or invalid.
- CMD
DRAFT_NOT_FOUNDThe draft does not exist anymore: it was sent, deleted, or saved again (every save returns a new draft_id).
- CMD
INVALID_RECIPIENTThe recipient is missing or not a valid email.
- CMD
MISSING_SUBJECTA new email needs a subject.
- CMD
MISSING_TARGETReply and forward need the original email, and it must still exist.
- CMD
RECIPIENT_LIMIT_EXCEEDEDto, cc and bcc together have more than 50 addresses.
- 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.