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.

Mailtrap CLI Setup

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

Install, configure, and verify
# 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 reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
api_token MAILTRAP_API_TOKEN Secret secret yes API Token

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call mailtrap.mailtrap_list_inboxes '{}' --json
Provider shortcut
kosmo integrations:mailtrap mailtrap_list_inboxes '{}' --json

Discovery

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

Discovery commands
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

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

mailtrap.mailtrap_list_inboxes

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

Read read
Parameters
none
Generic call
kosmo integrations:call mailtrap.mailtrap_list_inboxes '{}' --json
Shortcut
kosmo integrations:mailtrap mailtrap_list_inboxes '{}' --json

mailtrap.mailtrap_get_inbox

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

Read read
Parameters
inbox_id
Generic call
kosmo integrations:call mailtrap.mailtrap_get_inbox '{"inbox_id":1}' --json
Shortcut
kosmo integrations:mailtrap mailtrap_get_inbox '{"inbox_id":1}' --json

mailtrap.mailtrap_list_messages

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

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

mailtrap.mailtrap_get_message

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

Read read
Parameters
inbox_id, message_id
Generic call
kosmo integrations:call mailtrap.mailtrap_get_message '{"inbox_id":1,"message_id":1}' --json
Shortcut
kosmo integrations:mailtrap mailtrap_get_message '{"inbox_id":1,"message_id":1}' --json

mailtrap.mailtrap_send_test_email

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

Write write
Parameters
from, to, subject, text, html, inbox_id
Generic 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
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

List suppressions (blocked recipients) for a Mailtrap inbox.

Read read
Parameters
inbox_id, page, per_page
Generic call
kosmo integrations:call mailtrap.mailtrap_list_suppressions '{"inbox_id":1,"page":1,"per_page":1}' --json
Shortcut
kosmo integrations:mailtrap mailtrap_list_suppressions '{"inbox_id":1,"page":1,"per_page":1}' --json

mailtrap.mailtrap_get_current_user

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

Read read
Parameters
none
Generic call
kosmo integrations:call mailtrap.mailtrap_get_current_user '{}' --json
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 0 parameters
Schema command
kosmo integrations:schema mailtrap.mailtrap_list_inboxes --json
ParameterTypeRequiredDescription
No parameters.
mailtrap.mailtrap_get_inbox 1 parameters
Schema command
kosmo integrations:schema mailtrap.mailtrap_get_inbox --json
ParameterTypeRequiredDescription
inbox_id integer yes The inbox ID.
mailtrap.mailtrap_list_messages 4 parameters
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 2 parameters
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 6 parameters
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 = "me@example.com", 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 3 parameters
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 0 parameters
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.