Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions skills/mailtrap-authorizing-api-requests/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: mailtrap-authorizing-api-requests
description: Authenticate API requests to Mailtrap using Bearer tokens. Use when setting up Mailtrap API credentials, configuring environment variables, resolving authentication errors, or managing token scopes.
license: MIT
metadata:
category: business
author: mailtrap
source:
repository: https://github.com/mailtrap/mailtrap-skills
path: skills/authorizing-api-requests
---

# Authorizing API Requests to Mailtrap

This skill covers authenticating requests to the Mailtrap API using Bearer tokens.

## When to Use This Skill

- Setting up Mailtrap API credentials for the first time
- Configuring environment variables for API authentication
- Resolving 401 Unauthorized errors from the Mailtrap API
- Understanding token scopes for different API operations

## Authentication Method

All Mailtrap API requests use Bearer token authentication:

```javascript
headers: {
"Authorization": `Bearer ${process.env.MAILTRAP_API_TOKEN}`,
"Content-Type": "application/json",
}
```

## Getting Your API Token

1. Log in to mailtrap.io
2. Go to Settings → API Tokens
3. Create a new token or copy an existing one
4. Store it in your environment variables as `MAILTRAP_API_TOKEN`

## Token Scopes

- **Sending tokens:** For sending emails via the Email API
- **Sandbox tokens:** For testing via the Sandbox API (separate token per inbox)
- **Account tokens:** For managing contacts, domains, and account settings

## Best Practices

- Never hardcode tokens in source code
- Use separate tokens for production and sandbox environments
- Rotate tokens periodically and immediately if compromised
- Use environment variables or a secrets manager

## Related Skills

`mailtrap-sending-emails`, `mailtrap-testing-with-sandbox`
48 changes: 48 additions & 0 deletions skills/mailtrap-managing-contacts/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: mailtrap-managing-contacts
description: Manage email contacts, lists, and segments via the Mailtrap Contacts API. Use when importing contacts, creating contact lists, segmenting audiences, or syncing contacts from a CRM.
license: MIT
metadata:
category: business
author: mailtrap
source:
repository: https://github.com/mailtrap/mailtrap-skills
path: skills/managing-contacts
---

# Managing Contacts with Mailtrap

This skill covers managing email contacts, lists, and segments via the Mailtrap Contacts API.

## When to Use This Skill

- Importing or syncing contacts from a CRM or database
- Creating and managing contact lists for bulk sending
- Segmenting audiences for targeted email campaigns
- Adding or updating individual contacts programmatically

## Creating a Contact

```javascript
const response = await fetch("https://mailtrap.io/api/contacts", {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Contacts API endpoint may be missing the required account_id path segment

https://mailtrap.io/api/contacts looks incomplete; Mailtrap's Contacts API is account-scoped and typically requires the form https://mailtrap.io/api/accounts/{account_id}/contacts. Worth verifying against current Mailtrap API docs before merge, since a copy-pasted example that 404s undermines the skill's usefulness.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

method: "POST",
headers: {
"Authorization": `Bearer ${process.env.MAILTRAP_API_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
email: "user@example.com",
first_name: "Jane",
last_name: "Doe",
list_ids: ["your-list-id"],
}),
});
```

## Managing Lists

Create lists in the Mailtrap dashboard under Contacts → Lists, then reference list IDs when adding contacts via the API.

## Related Skills

`mailtrap-sending-emails`, `mailtrap-authorizing-api-requests`
70 changes: 70 additions & 0 deletions skills/mailtrap-sending-emails/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
name: mailtrap-sending-emails
description: Send transactional and bulk emails via Mailtrap Email API and SMTP. Use when implementing email sending features, configuring API/SMTP credentials, choosing between transactional and bulk sending, or troubleshooting delivery issues.
license: MIT

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Missing required metadata.source.license_path for a contributed third-party skill

Per CONTRIBUTING.md, contributed skills sourced from an external repository (this one is author: mailtrap, sourced from mailtrap/mailtrap-skills) must set metadata.source.license_path pointing at the LICENSE file in the upstream repo (see the angular-component and frontend-design skills for the established pattern). The top-level license: MIT alone does not satisfy this for contributed skills, and there is no metadata.source.license_path anywhere in this file's frontmatter.

This same issue applies to all 5 new files in this PR: mailtrap-sending-emails, mailtrap-authorizing-api-requests, mailtrap-setting-up-sending-domain, mailtrap-managing-contacts, mailtrap-testing-with-sandbox.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

metadata:
category: business
author: mailtrap
source:
repository: https://github.com/mailtrap/mailtrap-skills

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Missing required metadata.source.commit

CONTRIBUTING.md and AGENTS.md both require metadata.source.commit ("Full 40-character Git SHA... required for new imports") for every contributed skill's source block. bin/add-remote-skill.ts always populates this automatically when importing a skill, but it is absent here, so the pinned upstream revision can't be verified or diffed on future syncs.

Same issue affects all 5 new files in this PR.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

path: skills/sending-emails
---

# Sending Emails with Mailtrap

This skill covers sending transactional and bulk emails via the Mailtrap Email API and SMTP integration.

## When to Use This Skill

- Implementing email sending features (signup confirmations, password resets, notifications, invoices)
- Configuring Mailtrap Email API or SMTP credentials in an application
- Choosing between transactional and bulk sending modes
- Troubleshooting email delivery issues

## Email API vs SMTP

**Email API (recommended):** Use Mailtrap's REST API for sending. Faster, more reliable, and provides detailed delivery analytics.

**SMTP:** Use when your framework or library only supports SMTP, or when migrating from another SMTP provider.

## Sending via Email API

```javascript
const response = await fetch("https://send.api.mailtrap.io/api/send", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.MAILTRAP_API_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
from: { email: "hello@yourdomain.com", name: "Your App" },
to: [{ email: recipient }],
subject: "Your subject here",
html: "<p>Your email content</p>",
}),
});
```

## Sending via SMTP

Use these credentials in your SMTP configuration:

- **Host:** `live.smtp.mailtrap.io`
- **Port:** 587 (TLS) or 465 (SSL)
- **Username:** `api`
- **Password:** Your Mailtrap API token

## Transactional vs Bulk

- **Transactional:** One-to-one emails triggered by user actions (password resets, receipts). Use the `transactional` stream.
- **Bulk:** Marketing or batch emails sent to many recipients. Use the `bulk` stream.

## Best Practices

- Always verify your sending domain before going to production (see `mailtrap-setting-up-sending-domain`)
- Use the Mailtrap Sandbox for testing so emails never reach real inboxes (see `mailtrap-testing-with-sandbox`)
- Store your API token in environment variables, never hardcode it

## Related Skills

`mailtrap-authorizing-api-requests`, `mailtrap-setting-up-sending-domain`, `mailtrap-testing-with-sandbox`, `mailtrap-managing-contacts`
41 changes: 41 additions & 0 deletions skills/mailtrap-setting-up-sending-domain/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: mailtrap-setting-up-sending-domain
description: Verify a sending domain in Mailtrap for production email delivery. Use when setting up DNS records for email sending, configuring SPF, DKIM, and DMARC, or troubleshooting domain verification issues.
license: MIT
metadata:
category: business
author: mailtrap
source:
repository: https://github.com/mailtrap/mailtrap-skills
path: skills/setting-up-sending-domain
---

# Setting Up a Sending Domain with Mailtrap

This skill covers verifying a sending domain in Mailtrap for production email delivery.

## When to Use This Skill

- Setting up a new sending domain for production email
- Configuring SPF, DKIM, and DMARC DNS records
- Troubleshooting domain verification failures
- Improving email deliverability

## Required DNS Records

Mailtrap requires three DNS records to verify your domain:

**SPF** — Authorizes Mailtrap to send on your behalf:
**DKIM** — Signs outgoing emails cryptographically:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: SPF/DKIM/DMARC entries end with a colon but never show the actual record values

Lines 28-30 introduce each DNS record with a trailing colon ("Authorizes Mailtrap to send on your behalf:", "Signs outgoing emails cryptographically:", "Sets policy for failed authentication:") but no record value, format, or example (e.g. an actual v=spf1 ... / CNAME / v=DMARC1; p=... snippet) follows. Since documenting the required DNS records is this skill's stated purpose ("Required DNS Records"), a reader following it has no idea what to actually put in DNS, unlike the other four skills in this PR which all include concrete code/config examples.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

**DMARC** — Sets policy for failed authentication:

## Verification Steps

1. Add your domain in Mailtrap → Sending → Domains
2. Add the DNS records shown in the Mailtrap dashboard to your DNS provider
3. DNS propagation typically takes 24-48 hours
4. Click "Verify" in Mailtrap once records are in place

## Related Skills

`mailtrap-sending-emails`, `mailtrap-authorizing-api-requests`
52 changes: 52 additions & 0 deletions skills/mailtrap-testing-with-sandbox/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: mailtrap-testing-with-sandbox
description: Test email sending safely in development and staging using Mailtrap Sandbox. Use when setting up email testing environments, verifying email content without real delivery, or capturing test emails in CI/CD pipelines.
license: MIT
metadata:
category: business
author: mailtrap
source:
repository: https://github.com/mailtrap/mailtrap-skills
path: skills/testing-with-sandbox
---

# Testing Emails with Mailtrap Sandbox

This skill covers safe email testing in development and staging environments using Mailtrap Sandbox.

## When to Use This Skill

- Setting up email testing in local development or staging
- Verifying email content, formatting, and templates without real delivery
- Capturing emails in CI/CD pipelines
- Preventing test emails from reaching real inboxes

## How Sandbox Works

Mailtrap Sandbox captures all outgoing emails in a virtual inbox. Emails are never delivered to real recipients, making it safe to test with any email address.

## Setup

1. Create a Sandbox inbox at mailtrap.io
2. Copy the Sandbox API token from inbox settings
3. Use the Sandbox API endpoint instead of the production one:

```javascript
// Sandbox endpoint (dev/staging)
const ENDPOINT = `https://sandbox.api.mailtrap.io/api/send/${process.env.MAILTRAP_INBOX_ID}`;

// Production endpoint
const ENDPOINT = "https://send.api.mailtrap.io/api/send";
```

## Environment Separation Pattern

```javascript
const endpoint = process.env.NODE_ENV === "production"
? "https://send.api.mailtrap.io/api/send"
: `https://sandbox.api.mailtrap.io/api/send/${process.env.MAILTRAP_INBOX_ID}`;
```

## Related Skills

`mailtrap-sending-emails`, `mailtrap-authorizing-api-requests`