Email

Send email using Mailtrap

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.

post/api/email/mailtrap/send

Request

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

Request body

tostring email required

Recipient email address

fromstring email required

Sender email address

fromNamestring

Optional sender display name

subjectstring

Email subject line (required for non-template emails, optional for templates)

textstring

Plain text email body (not used with templates)

htmlstring

HTML email body (not used with templates)

replyTostring email

Optional reply-to email address

categorystring

Optional category for email tracking and analytics

isSandboxboolean

Whether to use sandbox mode for testing or production mode

testType'html' | 'text'

Specifies content format for testing (not used with templates)

useTemplateboolean

Whether to use a Mailtrap template instead of raw content

templateUuidstring uuid

Mailtrap template UUID (required when useTemplate is true)

Example request

{
  "to": "recipient@example.com",
  "from": "sender@kolect.ai",
  "fromName": "Kolect Team",
  "subject": "Welcome to Kolect!",
  "text": "Thank you for joining Kolect. We're excited to have you!",
  "html": "<p>Thank you for joining <strong>Kolect</strong>!</p>",
  "replyTo": "reply@kolect.ai",
  "category": "test",
  "isSandbox": true,
  "attachments": [
    {
      "url": "https://example.com/document.pdf",
      "filename": "document.pdf",
      "content_id": "logo.png",
      "disposition": "inline"
    }
  ],
  "testType": "html",
  "useTemplate": true,
  "templateUuid": "123e4567-e89b-12d3-a456-426614174000",
  "templateVariables": {
    "content": "Welcome to our platform! We're excited to have you join our community.",
    "subject": "Welcome to Kolect!",
    "user_name": "John Doe"
  }
}

Response

Email sent successfully

successboolean

Indicates successful email delivery

messagestring

Success message

timestampstring date-time

ISO timestamp of when the email was sent

dataobject

Response data from Mailtrap service

Example response

{
  "success": true,
  "message": "Template email sent successfully",
  "timestamp": "2025-01-27T10:30:00.000Z"
}

Changes

No recorded changes to this operation across all 1 revision of this API.