---
title: "Send email using Mailtrap"
method: POST
path: "/api/email/mailtrap/send"
tags: ["Email"]
---

# Send email using Mailtrap

`POST /api/email/mailtrap/send`

## Request

- Base URL: `https://api.kolect.com`
- URL: `https://api.kolect.com/api/email/mailtrap/send`
- Auth: HTTP bearer

Sends an email using the Mailtrap email service. Supports both template-based  and regular emails with HTML/text content. When using templates, the content  is automatically formatted and template variables are processed.

## Request body

- object
  - `to` string, email, required: Recipient email address
  - `from` string, email, required: Sender email address
  - `fromName` string: Optional sender display name
  - `subject` string: Email subject line (required for non-template emails, optional for templates)
  - `text` string: Plain text email body (not used with templates)
  - `html` string: HTML email body (not used with templates)
  - `replyTo` string, email: Optional reply-to email address
  - `category` string: Optional category for email tracking and analytics
  - `isSandbox` boolean: Whether to use sandbox mode for testing or production mode
  - `attachments` object[]: Optional array of file URLs or paths to attach to the email
    - `url` string: URL or file path to the attachment
    - `filename` string: Optional custom filename for the attachment
    - `content_id` string: Optional content ID for inline images, use in HTML as cid:contentId
    - `disposition` 'attachment' | 'inline': How the attachment should be displayed, defaults to attachment
  - `testType` 'html' | 'text': Specifies content format for testing (not used with templates)
  - `useTemplate` boolean: Whether to use a Mailtrap template instead of raw content
  - `templateUuid` string, uuid: Mailtrap template UUID (required when useTemplate is true)
  - `templateVariables` object: Variables to pass to the template
    - `content` string: Main content for the template (auto-formatted to HTML paragraphs if plain text)
    - `subject` string: Subject line for template (can also be passed in main subject field)

## Response `200`

Email sent successfully

- object
  - `success` boolean: Indicates successful email delivery
  - `message` string: Success message
  - `timestamp` string, date-time: ISO timestamp of when the email was sent
  - `data` object: Response data from Mailtrap service

## Other responses

- `400`: Bad request - Missing required fields or invalid input
- `500`: Internal server error - Failed to send email

---

[API](https://skmtc.dev/kolect/apis/kolect-api.md) · [All operations](https://skmtc.dev/kolect/apis/kolect-api/llms.txt) · [OpenAPI document](https://skmtc.dev/kolect/apis/kolect-api/revisions/fe54528e8f54?raw)
