IM
EN
Docs Home
Menu
Guides

Send Outbound Email

Enqueue SMTP send tasks with optional inline parts and attachments.

inbox-manager client-flow

Send Outbound Email

Purpose: enqueue SMTP send actions with optional inline parts and attachments.

UI Flow

  1. User composes message.
  2. UI captures recipients, subject, body, attachments.
  3. UI enqueues POST /api/accounts/:account_id/smtp/messages.
  4. UI tracks resulting task/job until completion.
  5. UI refreshes outbound email list.

Client Library Flow

const queued = await api.provider.smtp.sendMessage(accountId, {
  credential_id: smtpCredentialId,
  direction: "outbound",
  from_json: [{ address: "info@example.com" }],
  to_json: [{ address: "recipient@example.com" }],
  subject: "Status update",
  text_body: "Hello from Inbox Manager",
  html_body: "<p>Hello from Inbox Manager</p>",
  attachments: [
    {
      filename: "report.txt",
      content_type: "text/plain",
      content_b64: Buffer.from("report body").toString("base64"),
      disposition: "attachment",
    },
  ],
});
await api.jobs.waitForTask(accountId, queued.data.task_id);

HTTP/curl Flow

API_BASE_URL="https://api.inbox-manager.com"

curl -sS -X POST "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/smtp/messages" \
  -H "authorization: Bearer ${BEARER_TOKEN}" \
  -H "content-type: application/json" \
  --data "{
    \"credential_id\":\"${SMTP_CREDENTIAL_ID}\",
    \"direction\":\"outbound\",
    \"from_json\":[{\"address\":\"${FROM_ADDRESS}\"}],
    \"to_json\":[{\"address\":\"${TO_ADDRESS}\"}],
    \"subject\":\"Status update\",
    \"text_body\":\"Hello from Inbox Manager\",
    \"attachments\":[
      {
        \"filename\":\"report.txt\",
        \"content_type\":\"text/plain\",
        \"content_b64\":\"${ATTACHMENT_B64}\",
        \"disposition\":\"attachment\"
      }
    ]
  }"

Notes

  • Outbound send is asynchronous and job-backed.
  • Empty recipient set fails fast.