KosmoKrator

productivity

Mailtrap CLI for AI Agents

Use the Mailtrap CLI from KosmoKrator to call Mailtrap tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 6 read 1 write API token auth

Mailtrap CLI Setup

Mailtrap can be configured headlessly with `kosmokrator integrations:configure mailtrap`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure mailtrap --set api_token="$MAILTRAP_API_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor mailtrap --json
kosmokrator integrations:status --json

Credentials

Authentication type: API token api_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_token MAILTRAP_API_TOKEN Secret secret yes API Token

Call Mailtrap Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call mailtrap.mailtrap_list_inboxes '{}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:mailtrap mailtrap_list_inboxes '{}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs mailtrap --json
kosmo integrations:docs mailtrap.mailtrap_list_inboxes --json
kosmo integrations:schema mailtrap.mailtrap_list_inboxes --json
kosmo integrations:search "Mailtrap" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Mailtrap.

mailtrap.mailtrap_list_inboxes

Read read

List all inboxes in the Mailtrap account. Returns inbox IDs, names, and email addresses.

Parameters
none

Generic CLI call

kosmo integrations:call mailtrap.mailtrap_list_inboxes '{}' --json

Provider shortcut

kosmo integrations:mailtrap mailtrap_list_inboxes '{}' --json

mailtrap.mailtrap_get_inbox

Read read

Get details for a specific Mailtrap inbox by ID, including its email address, settings, and message counts.

Parameters
inbox_id

Generic CLI call

kosmo integrations:call mailtrap.mailtrap_get_inbox '{"inbox_id":1}' --json

Provider shortcut

kosmo integrations:mailtrap mailtrap_get_inbox '{"inbox_id":1}' --json

mailtrap.mailtrap_list_messages

Read read

List messages in a Mailtrap inbox with optional search and pagination.

Parameters
inbox_id, page, per_page, search

Generic CLI call

kosmo integrations:call mailtrap.mailtrap_list_messages '{"inbox_id":1,"page":1,"per_page":1,"search":"example_search"}' --json

Provider shortcut

kosmo integrations:mailtrap mailtrap_list_messages '{"inbox_id":1,"page":1,"per_page":1,"search":"example_search"}' --json

mailtrap.mailtrap_get_message

Read read

Get a single message from a Mailtrap inbox by its ID, including subject, sender, recipient, and body.

Parameters
inbox_id, message_id

Generic CLI call

kosmo integrations:call mailtrap.mailtrap_get_message '{"inbox_id":1,"message_id":1}' --json

Provider shortcut

kosmo integrations:mailtrap mailtrap_get_message '{"inbox_id":1,"message_id":1}' --json

mailtrap.mailtrap_send_test_email

Write write

Send a test email through Mailtrap. Provide sender, recipient(s), subject, and either text or HTML body.

Parameters
from, to, subject, text, html, inbox_id

Generic CLI call

kosmo integrations:call mailtrap.mailtrap_send_test_email '{"from":"example_from","to":"example_to","subject":"example_subject","text":"example_text","html":"example_html","inbox_id":1}' --json

Provider shortcut

kosmo integrations:mailtrap mailtrap_send_test_email '{"from":"example_from","to":"example_to","subject":"example_subject","text":"example_text","html":"example_html","inbox_id":1}' --json

mailtrap.mailtrap_list_suppressions

Read read

List suppressions (blocked recipients) for a Mailtrap inbox.

Parameters
inbox_id, page, per_page

Generic CLI call

kosmo integrations:call mailtrap.mailtrap_list_suppressions '{"inbox_id":1,"page":1,"per_page":1}' --json

Provider shortcut

kosmo integrations:mailtrap mailtrap_list_suppressions '{"inbox_id":1,"page":1,"per_page":1}' --json

mailtrap.mailtrap_get_current_user

Read read

Get the current Mailtrap user profile and account info. Useful as a health check.

Parameters
none

Generic CLI call

kosmo integrations:call mailtrap.mailtrap_get_current_user '{}' --json

Provider shortcut

kosmo integrations:mailtrap mailtrap_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

mailtrap.mailtrap_list_inboxes

List all inboxes in the Mailtrap account. Returns inbox IDs, names, and email addresses.

Operation
Read read
Schema command
kosmo integrations:schema mailtrap.mailtrap_list_inboxes --json
ParameterTypeRequiredDescription
No parameters.

mailtrap.mailtrap_get_inbox

Get details for a specific Mailtrap inbox by ID, including its email address, settings, and message counts.

Operation
Read read
Schema command
kosmo integrations:schema mailtrap.mailtrap_get_inbox --json
ParameterTypeRequiredDescription
inbox_id integer yes The inbox ID.

mailtrap.mailtrap_list_messages

List messages in a Mailtrap inbox with optional search and pagination.

Operation
Read read
Schema command
kosmo integrations:schema mailtrap.mailtrap_list_messages --json
ParameterTypeRequiredDescription
inbox_id integer yes The inbox ID to list messages from.
page integer no Page number for pagination (1-based).
per_page integer no Number of messages per page (default: 25).
search string no Search query to filter messages by subject, from, or to.

mailtrap.mailtrap_get_message

Get a single message from a Mailtrap inbox by its ID, including subject, sender, recipient, and body.

Operation
Read read
Schema command
kosmo integrations:schema mailtrap.mailtrap_get_message --json
ParameterTypeRequiredDescription
inbox_id integer yes The inbox ID.
message_id integer yes The message ID.

mailtrap.mailtrap_send_test_email

Send a test email through Mailtrap. Provide sender, recipient(s), subject, and either text or HTML body.

Operation
Write write
Schema command
kosmo integrations:schema mailtrap.mailtrap_send_test_email --json
ParameterTypeRequiredDescription
from object yes Sender object with "email" and optionally "name". E.g. {email = "[email protected]", name = "Me"}.
to array yes Array of recipient objects, each with "email" and optionally "name".
subject string yes Email subject line.
text string no Plain text email body.
html string no HTML email body.
inbox_id integer no Inbox ID to send from (required for Testing inbox type).

mailtrap.mailtrap_list_suppressions

List suppressions (blocked recipients) for a Mailtrap inbox.

Operation
Read read
Schema command
kosmo integrations:schema mailtrap.mailtrap_list_suppressions --json
ParameterTypeRequiredDescription
inbox_id integer yes The inbox ID.
page integer no Page number for pagination (1-based).
per_page integer no Number of results per page.

mailtrap.mailtrap_get_current_user

Get the current Mailtrap user profile and account info. Useful as a health check.

Operation
Read read
Schema command
kosmo integrations:schema mailtrap.mailtrap_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.