mailtrap_list_inboxes
List all inboxes in the Mailtrap account. Returns inbox IDs, names, and email addresses.
- Operation
- Read
read - Full name
mailtrap.mailtrap_list_inboxes
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
productivity
Agent-facing Lua documentation and function reference for the Mailtrap KosmoKrator integration.
Agents call this integration through app.integrations.mailtrap.*.
Use lua_read_doc("integrations.mailtrap") inside KosmoKrator to discover the same reference at runtime.
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
List all inboxes in the Mailtrap account. Returns inbox IDs, names, and email addresses.
None.
local inboxes = app.integrations.mailtrap.list_inboxes()
for _, inbox in ipairs(inboxes) do
print(inbox.name .. " — " .. inbox.email .. " (ID: " .. inbox.id .. ")")
end
Get details for a specific Mailtrap inbox by ID.
| Name | Type | Required | Description |
|---|---|---|---|
inbox_id | integer | yes | The inbox ID. |
local inbox = app.integrations.mailtrap.get_inbox({
inbox_id = 12345
})
print("Inbox: " .. inbox.name)
print("Email: " .. inbox.email)
print("Messages: " .. (inbox.messages_count or 0))
List messages in a Mailtrap inbox with optional search and pagination.
| Name | Type | Required | Description |
|---|---|---|---|
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. |
local result = app.integrations.mailtrap.list_messages({
inbox_id = 12345,
per_page = 10
})
for _, msg in ipairs(result) do
print(msg.subject .. " from " .. msg.from_email)
end
-- Search messages
local result = app.integrations.mailtrap.list_messages({
inbox_id = 12345,
search = "welcome"
})
Get a single message from a Mailtrap inbox by its ID, including subject, sender, recipient, and body.
| Name | Type | Required | Description |
|---|---|---|---|
inbox_id | integer | yes | The inbox ID. |
message_id | integer | yes | The message ID. |
local msg = app.integrations.mailtrap.get_message({
inbox_id = 12345,
message_id = 67890
})
print("Subject: " .. msg.subject)
print("From: " .. msg.from_email)
print("To: " .. msg.to_email)
print("HTML body length: " .. #(msg.html_body or ""))
Send a test email through Mailtrap. Provide sender, recipient(s), subject, and either text or HTML body.
| Name | Type | Required | Description |
|---|---|---|---|
from | object | yes | Sender object with email and optionally name. |
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). |
local result = app.integrations.mailtrap.send_test_email({
from = { email = "[email protected]", name = "Sender" },
to = { { email = "[email protected]", name = "Recipient" } },
subject = "Test Email",
text = "This is a test email sent via Mailtrap.",
html = "<h1>Test</h1><p>This is a test email sent via Mailtrap.</p>"
})
print("Email sent successfully")
List suppressions (blocked recipients) for a Mailtrap inbox.
| Name | Type | Required | Description |
|---|---|---|---|
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. |
local result = app.integrations.mailtrap.list_suppressions({
inbox_id = 12345
})
for _, sup in ipairs(result) do
print("Suppressed: " .. sup.email .. " — " .. (sup.reason or "unknown"))
end
Get the current Mailtrap user profile and account info. Useful as a health check.
None.
local user = app.integrations.mailtrap.get_current_user()
print("Logged in as: " .. user.email)
print("Account: " .. (user.company or "personal"))
If you have multiple mailtrap accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.mailtrap.function_name({...})
-- Explicit default (portable across setups)
app.integrations.mailtrap.default.function_name({...})
-- Named accounts
app.integrations.mailtrap.testing.function_name({...})
app.integrations.mailtrap.production.function_name({...})
All functions are identical across accounts — only the credentials differ.
# Mailtrap — Lua API Reference
## list_inboxes
List all inboxes in the Mailtrap account. Returns inbox IDs, names, and email addresses.
### Parameters
None.
### Examples
```lua
local inboxes = app.integrations.mailtrap.list_inboxes()
for _, inbox in ipairs(inboxes) do
print(inbox.name .. " — " .. inbox.email .. " (ID: " .. inbox.id .. ")")
end
```
---
## get_inbox
Get details for a specific Mailtrap inbox by ID.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `inbox_id` | integer | yes | The inbox ID. |
### Examples
```lua
local inbox = app.integrations.mailtrap.get_inbox({
inbox_id = 12345
})
print("Inbox: " .. inbox.name)
print("Email: " .. inbox.email)
print("Messages: " .. (inbox.messages_count or 0))
```
---
## list_messages
List messages in a Mailtrap inbox with optional search and pagination.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `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. |
### Examples
```lua
local result = app.integrations.mailtrap.list_messages({
inbox_id = 12345,
per_page = 10
})
for _, msg in ipairs(result) do
print(msg.subject .. " from " .. msg.from_email)
end
```
```lua
-- Search messages
local result = app.integrations.mailtrap.list_messages({
inbox_id = 12345,
search = "welcome"
})
```
---
## get_message
Get a single message from a Mailtrap inbox by its ID, including subject, sender, recipient, and body.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `inbox_id` | integer | yes | The inbox ID. |
| `message_id` | integer | yes | The message ID. |
### Examples
```lua
local msg = app.integrations.mailtrap.get_message({
inbox_id = 12345,
message_id = 67890
})
print("Subject: " .. msg.subject)
print("From: " .. msg.from_email)
print("To: " .. msg.to_email)
print("HTML body length: " .. #(msg.html_body or ""))
```
---
## send_test_email
Send a test email through Mailtrap. Provide sender, recipient(s), subject, and either text or HTML body.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `from` | object | yes | Sender object with `email` and optionally `name`. |
| `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). |
### Examples
```lua
local result = app.integrations.mailtrap.send_test_email({
from = { email = "[email protected]", name = "Sender" },
to = { { email = "[email protected]", name = "Recipient" } },
subject = "Test Email",
text = "This is a test email sent via Mailtrap.",
html = "<h1>Test</h1><p>This is a test email sent via Mailtrap.</p>"
})
print("Email sent successfully")
```
---
## list_suppressions
List suppressions (blocked recipients) for a Mailtrap inbox.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `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. |
### Examples
```lua
local result = app.integrations.mailtrap.list_suppressions({
inbox_id = 12345
})
for _, sup in ipairs(result) do
print("Suppressed: " .. sup.email .. " — " .. (sup.reason or "unknown"))
end
```
---
## get_current_user
Get the current Mailtrap user profile and account info. Useful as a health check.
### Parameters
None.
### Examples
```lua
local user = app.integrations.mailtrap.get_current_user()
print("Logged in as: " .. user.email)
print("Account: " .. (user.company or "personal"))
```
---
## Multi-Account Usage
If you have multiple mailtrap accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.mailtrap.function_name({...})
-- Explicit default (portable across setups)
app.integrations.mailtrap.default.function_name({...})
-- Named accounts
app.integrations.mailtrap.testing.function_name({...})
app.integrations.mailtrap.production.function_name({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.mailtrap.mailtrap_list_inboxes({})
print(result) mailtrap_list_inboxesList all inboxes in the Mailtrap account. Returns inbox IDs, names, and email addresses.
readmailtrap.mailtrap_list_inboxes| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
mailtrap_get_inboxGet details for a specific Mailtrap inbox by ID, including its email address, settings, and message counts.
readmailtrap.mailtrap_get_inbox| Parameter | Type | Required | Description |
|---|---|---|---|
inbox_id | integer | yes | The inbox ID. |
mailtrap_list_messagesList messages in a Mailtrap inbox with optional search and pagination.
readmailtrap.mailtrap_list_messages| Parameter | Type | Required | Description |
|---|---|---|---|
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_get_messageGet a single message from a Mailtrap inbox by its ID, including subject, sender, recipient, and body.
readmailtrap.mailtrap_get_message| Parameter | Type | Required | Description |
|---|---|---|---|
inbox_id | integer | yes | The inbox ID. |
message_id | integer | yes | The message ID. |
mailtrap_send_test_emailSend a test email through Mailtrap. Provide sender, recipient(s), subject, and either text or HTML body.
writemailtrap.mailtrap_send_test_email| Parameter | Type | Required | Description |
|---|---|---|---|
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_list_suppressionsList suppressions (blocked recipients) for a Mailtrap inbox.
readmailtrap.mailtrap_list_suppressions| Parameter | Type | Required | Description |
|---|---|---|---|
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_get_current_userGet the current Mailtrap user profile and account info. Useful as a health check.
readmailtrap.mailtrap_get_current_user| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||