-
Notifications
You must be signed in to change notification settings - Fork 84
Add Mailtrap email skills (sending, API auth, domain setup, contacts, sandbox testing) #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f9b1f5c
9b94ddc
7634bfa
b058016
daf385e
e75387a
a7fc7c8
d40a1cc
0e272d8
c9d6357
d0068a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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` |
| 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", { | ||
| 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` | ||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: Missing required Per This same issue applies to all 5 new files in this PR: Reply with |
||
| metadata: | ||
| category: business | ||
| author: mailtrap | ||
| source: | ||
| repository: https://github.com/mailtrap/mailtrap-skills | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: Missing required
Same issue affects all 5 new files in this PR. Reply with |
||
| 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` | ||
| 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: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Reply with |
||
| **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` | ||
| 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` |
There was a problem hiding this comment.
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_idpath segmenthttps://mailtrap.io/api/contactslooks incomplete; Mailtrap's Contacts API is account-scoped and typically requires the formhttps://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 itto have Kilo Code address this issue.