Skip to main content

Overview

Send emails from any inbox with full support for HTML, plain text, attachments, CC/BCC recipients, and custom labels. All sent emails are automatically organized into threads.

Sending a Basic Email

import Sendook from "@sendook/node";

const client = new Sendook("your_api_key");

// Send an email
await client.inbox.message.send({
  inboxId: "inbox_123",
  to: ["[email protected]"],
  subject: "Welcome to Sendook!",
  text: "Thanks for signing up.",
  html: "<p>Thanks for signing up.</p>"
});
Both text and html fields are required. The HTML version will be shown to email clients that support it, while the text version is used as a fallback.

Required Parameters

ParameterTypeDescription
inboxIdstringID of the inbox to send from
tostring[]Array of recipient email addresses
subjectstringEmail subject line
textstringPlain text version of the email
htmlstringHTML version of the email

Optional Parameters

CC and BCC

Send copies to additional recipients:
await client.inbox.message.send({
  inboxId: "inbox_123",
  to: ["[email protected]"],
  cc: ["[email protected]", "[email protected]"],
  bcc: ["[email protected]"],
  subject: "Project Update",
  text: "Here's the latest update...",
  html: "<p>Here's the latest update...</p>"
});

Labels

Organize emails with custom labels for easier filtering:
await client.inbox.message.send({
  inboxId: "inbox_123",
  to: ["[email protected]"],
  labels: ["onboarding", "automated", "welcome-series"],
  subject: "Welcome!",
  text: "Welcome to our platform.",
  html: "<p>Welcome to our platform.</p>"
});
Labels are useful for categorizing messages in your dashboard and filtering messages via the API.

Attachments

Include files with your emails:
await client.inbox.message.send({
  inboxId: "inbox_123",
  to: ["[email protected]"],
  subject: "Invoice #1234",
  text: "Please find your invoice attached.",
  html: "<p>Please find your invoice attached.</p>",
  attachments: [
    {
      content: "base64EncodedContent...",
      name: "invoice.pdf",
      contentType: "application/pdf"
    },
    {
      content: "base64EncodedImageContent...",
      name: "logo.png",
      contentType: "image/png"
    }
  ]
});

Attachment Properties

PropertyTypeRequiredDescription
contentstringYesBase64-encoded file content
namestringNoFilename (e.g., “document.pdf”)
contentTypestringNoMIME type (e.g., “application/pdf”)
Attachment content must be base64-encoded. Most programming languages have built-in libraries to encode files to base64.

Replying to Messages

Reply to an existing message to continue the conversation thread:
await client.inbox.message.reply({
  inboxId: "inbox_123",
  messageId: "msg_456",
  text: "Thanks for your message!",
  html: "<p>Thanks for your message!</p>"
});
When you reply:
  • The subject is automatically prefixed with “Re:”
  • The recipient is set to the sender of the original message
  • The reply is added to the same thread as the original message

Response Format

Successful send requests return the created message object:
{
  "id": "msg_789",
  "organizationId": "org_456",
  "inboxId": "inbox_123",
  "threadId": "thread_012",
  "from": "[email protected]",
  "fromInboxId": "inbox_123",
  "to": ["[email protected]"],
  "cc": [],
  "bcc": [],
  "labels": ["welcome"],
  "subject": "Welcome to Sendook!",
  "text": "Thanks for signing up.",
  "html": "<p>Thanks for signing up.</p>",
  "attachments": [],
  "status": "sent",
  "externalMessageId": "<aws-ses-message-id>",
  "createdAt": "2024-01-01T12:00:00.000Z",
  "updatedAt": "2024-01-01T12:00:00.000Z"
}

Message Status

Messages go through different statuses:
StatusDescription
sentMessage was successfully sent to AWS SES
deliveredMessage was delivered to recipient’s mail server
bouncedMessage bounced (invalid email or server rejection)
complainedRecipient marked the message as spam
rejectedMessage was rejected before sending
You’ll receive webhook events for each status change. See Webhooks for details.

Rate Limits

Sendook implements rate limiting to prevent abuse:
  • 100 emails per hour per API key
  • Rate limit resets hourly
If you exceed the rate limit, the API will return a 429 error. Plan your email sending accordingly or contact support for higher limits.

Threads

All sent messages are automatically organized into threads:
  • New messages create a new thread
  • Replies are added to existing threads
  • Each thread contains all messages in a conversation
Learn more in Threads.

Webhooks

Sending emails triggers the following webhook events:
  • message.sent - Message was sent to AWS SES
  • message.delivered - Message was delivered successfully
  • message.bounced - Message bounced
  • message.complained - Recipient marked as spam
  • message.rejected - Message was rejected
See Webhooks for setup instructions.

Best Practices

Some email clients don’t support HTML or users may have it disabled. Always provide both versions for the best user experience.
Large attachments can cause delivery issues. Consider hosting large files and including download links instead.
Labels make it easier to filter and search messages later. Use consistent naming conventions for your labels.
When testing in production, use BCC to send yourself a copy without exposing your email to recipients.
Set up webhooks to track delivery status and handle bounces appropriately in your application.

Next Steps

Receive Emails

Learn how to receive and process incoming emails

Webhooks

Set up webhooks to track message status

Threads

Understand how threads organize conversations

Custom Domains

Improve deliverability with custom domains

Build docs developers (and LLMs) love