# Mailtrap

> Manage email sandboxes and projects; inspect captured messages and delivery diagnostics.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/mailtrap

## Actions

### Analyze message html

Check a test email's HTML for parts that email clients don't support, returning each problem found and which clients it affects.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Inbox (`inbox_id`, number, required): Inbox ID. At least 1.
- Message ID (`message_id`, number, required): Message ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "errors": [],
    "status": "example"
  }
}
```

### Clean sandbox

Delete every test email in a sandbox, leaving the sandbox itself in place. Returns the emptied sandbox.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Inbox (`inbox_id`, number, required): Inbox ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```

### Create project

Create a new Email Sandbox project with the given name in an account. Returns the new project and its ID.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Name (`name`, text, required): Name.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "id": 1,
    "inboxes": [],
    "name": "example"
  }
}
```

### Create sandbox

Create a new email sandbox with the given name in a project. Returns the new sandbox with its ID and SMTP settings.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Project (`project_id`, number, required): Project ID. At least 1.
- Name (`name`, text, required): Name.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "id": 1,
    "name": "example",
    "project_id": 1
  }
}
```

### Delete message

Delete one test email from a sandbox by its ID.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Inbox (`inbox_id`, number, required): Inbox ID. At least 1.
- Message ID (`message_id`, number, required): Message ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```

### Delete project

Delete a sandbox project from an account by its ID.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Project (`project_id`, number, required): Project ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```

### Delete sandbox

Delete an email sandbox by its ID, along with all the test emails in it.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Inbox (`inbox_id`, number, required): Inbox ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```

### Get message

Get one test email in a sandbox by its ID, returning its sender, recipients, subject, sent time, size and links to its body.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Inbox (`inbox_id`, number, required): Inbox ID. At least 1.
- Message ID (`message_id`, number, required): Message ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "created_at": "example",
    "id": 1,
    "inbox_id": 1,
    "is_read": false,
    "sent_at": "example",
    "subject": "example"
  }
}
```

### Get message headers

Get the full email headers of a test email in a sandbox, such as its sender, recipients, date and message ID.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Inbox (`inbox_id`, number, required): Inbox ID. At least 1.
- Message ID (`message_id`, number, required): Message ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "headers": {}
  }
}
```

### Get project

Get one sandbox project by its ID, returning its name and the sandboxes in it.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Project (`project_id`, number, required): Project ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "id": 1,
    "inboxes": [],
    "name": "example"
  }
}
```

### Get sandbox

Get one email sandbox by its ID, returning its name, email address, SMTP settings and message counts.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Inbox (`inbox_id`, number, required): Inbox ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "id": 1,
    "name": "example",
    "project_id": 1
  }
}
```

### Get spam report

Get the spam analysis of a test email, returning its overall spam score and the rules it triggered.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Inbox (`inbox_id`, number, required): Inbox ID. At least 1.
- Message ID (`message_id`, number, required): Message ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "Details": [],
    "Score": 1.0,
    "Spam": false
  }
}
```

### List accounts

List the Mailtrap accounts the API token can reach, returning each account's ID, name and your access level.

**Inputs**: None.

**Outputs**

- `data` (list): Response.

**Example output**

```json
{
  "data": []
}
```

### List messages

List the test emails caught in a sandbox, optionally matching a search term. Returns one page; pass the last message ID for the next page.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Inbox (`inbox_id`, number, required): Inbox ID. At least 1.
- Last ID (`last_id`, number): Last ID. At least 1.
- Search (`search`, text): Search.

**Outputs**

- `data` (list): Response.

**Example output**

```json
{
  "data": []
}
```

### List projects

List the Email Sandbox projects in an account, returning each project with its ID, name and sandboxes.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.

**Outputs**

- `data` (list): Response.

**Example output**

```json
{
  "data": []
}
```

### List sandboxes

List the email sandboxes (test inboxes) in an account, returning each one's ID, name, email address and message counts.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.

**Outputs**

- `data` (list): Response.

**Example output**

```json
{
  "data": []
}
```

### Send test email

Capture a test email in a Mailtrap sandbox. No email is delivered to real recipients.

**Inputs**

- Account (`account_id`, number, required): Account id. At least 1.
- Inbox (`inbox_id`, number, required): Inbox id. At least 1.
- Sender email (`sender_email`, text, required): Sender email.
- Recipient emails (`recipient_emails`, list, required): Recipient emails.
- Subject (`subject`, text, required): Subject.
- Text (`text`, text, required): Text.
- Html (`html`, text): Html.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "message_ids": [],
    "success": false
  }
}
```

### Update message

Mark a test email in a sandbox as read or unread. Returns the updated message.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Inbox (`inbox_id`, number, required): Inbox ID. At least 1.
- Message ID (`message_id`, number, required): Message ID. At least 1.
- Is read (`is_read`, true/false, required): Is read.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "created_at": "example",
    "id": 1,
    "inbox_id": 1,
    "is_read": false,
    "sent_at": "example",
    "subject": "example"
  }
}
```

### Update project

Rename a sandbox project by its ID. Returns the updated project.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Project (`project_id`, number, required): Project ID. At least 1.
- Name (`name`, text, required): Name.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "id": 1,
    "inboxes": [],
    "name": "example"
  }
}
```

### Update sandbox

Change an email sandbox's name or the username part of its email address. Returns the updated sandbox.

**Inputs**

- Account (`account_id`, number, required): Account ID. At least 1.
- Inbox (`inbox_id`, number, required): Inbox ID. At least 1.
- Name (`name`, text): Name.
- Email username (`email_username`, text): Email username.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "id": 1,
    "name": "example",
    "project_id": 1
  }
}
```
