mailtrap-sending-emails – skill Marketing & SEO cho agent AI
Cấu hình hoặc khắc phục sự cố gửi email thực tế với Mailtrap qua Email API, SMTP, luồng transactional, luồng bulk hoặc batch.
Cài skill mailtrap-sending-emails bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/mailtrap-sending-emails-a6c4f.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /mailtrap-sending-emails – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/mailtrap-sending-emails-a6c4f.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $mailtrap-sending-emails – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/mailtrap-sending-emails-a6c4f.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /mailtrap-sending-emails – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/mailtrap-sending-emails-a6c4f.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /mailtrap-sending-emails – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Sending emails (Mailtrap)
Overview
Mailtrap sends live email over Email API (REST) or SMTP. Two streams apply for API/SMTP: Transactional (non-promotional, app-generated) and Bulk (promotional / marketing volume). Batch is not a third stream: it is how you submit many messages in one request on whichever stream matches the content. Campaigns are a separate product path for promotional mail to Mailtrap contacts. Pair this sheet with the [Transactional](https://docs.mailtrap.io/developers/email-sending/transactional.md) / [Bulk](https://docs.mailtrap.io/developers/email-sending/bulk.md) developer pages when building or debugging integrations (including with AI-assisted coding).
When to Use
Use when integrating, configuring, or troubleshooting Mailtrap live email sending with Email API, SMTP, transactional streams, bulk streams, or batch requests.
Sending authority and delivery checks
Live send examples deliver externally. Before any send, confirm the approved sender, exact recipient list, final content/template variables, stream and message count. Integration or troubleshooting alone does not authorize sending. Use the sandbox for tests unless live delivery is requested; do not treat example recipients as real targets. Keep tokens out of logged process arguments (use protected header stdin/config or the SDK), redact responses, and check delivery state before retrying an uncertain POST to avoid duplicate mail. Account limits and suppression behavior require current docs; do not bypass unsubscribes or suppressions.
How to integrate (preference order)
Preferred order:
1. Plugin or integration for the user's platform (no-code or minimal-config) _where available_
2. Official SDK for your language when one exists (maintained clients, typed helpers, less room for URL/auth mistakes).
3. HTTP Email API when there is no SDK or the SDK does not fit (direct POST to /api/send or /api/batch with JSON).
4. SMTP only when you really need it (legacy stack, host/platform that only speaks SMTP, or hard constraints that rule out HTTP).
Choosing how to send
| Approach | Use when |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Transactional, single message | Email generated by your app (password resets, receipts, notifications, alerts). One logical message per POST https://send.api.mailtrap.io/api/send |
| Bulk | Promotional email to contacts that you manage on your side and send at volume through Mailtrap. Not the same as "batch": bulk is the stream, not the batch endpoint. |
| Batch | You have multiple different messages to hand off at the same time (up to 500 per request). Cuts HTTP overhead; can be applied to both transactional and bulk |
| Campaigns | Promotional email to recipients stored as Mailtrap contacts, using Mailtrap Campaigns (audiences, scheduling, reporting in the product). Recommended to avoid implementing contact management and email sending logic; requires UI setup before sends flow—this skill does not replace that workflow. |
Before generating SDK code: read the README of the relevant SDK repository linked in the SDKs section below for current method signatures, constructor options, and examples. Do not rely on memory.
Related skills: mailtrap-testing-with-sandbox (safe testing) and mailtrap-setting-up-sending-domain (verification before send).
When not to use
- Sandbox only—capturing mail without delivery, reading messages in a sandbox (
mailtrap-testing-with-sandbox). - The main ask is webhooks, step-by-step Campaigns UI setup, or deliverability deep-dives.
- Exhaustive API reference—once the user's path is clear, link the official send docs for full schemas, optional fields, and edge cases.
Quick reference
Email API
| Stream | Send Endpoint | Batch Endpoint | Authorization Header |
| ------------------------------------- | -------------------------------------------- | --------------------------------------------- | ------------------------------------------ |
| Transactional | POST https://send.api.mailtrap.io/api/send | POST https://send.api.mailtrap.io/api/batch | Authorization: Bearer $MAILTRAP_API_TOKEN |
| Bulk (promotional / marketing volume) | POST https://bulk.api.mailtrap.io/api/send | POST https://bulk.api.mailtrap.io/api/batch | Authorization: Bearer $MAILTRAP_API_TOKEN |
SMTP
| Setting | Transactional | Bulk |
| -------- | --------------------------------- | --------------------------------- |
| Host | live.smtp.mailtrap.io | bulk.smtp.mailtrap.io |
| Port | 587 (also 25, 2525, 465 with SSL) | 587 (also 25, 2525, 465 with SSL) |
| Username | api | api |
| Password | API token ($MAILTRAP_API_TOKEN) | API token ($MAILTRAP_API_TOKEN) |
Tokens
Use $MAILTRAP_API_TOKEN in either Authorization: Bearer ... or Api-Token: .... The same token works on both send.api.mailtrap.io and bulk.api.mailtrap.io as long as its scope covers the stream. Store tokens in environment variables or a secrets manager and rotate them when access changes.
Rate limits
| Scope | Limit | Window |
| ----------------------- | ------------ | ---------- |
| Sending API (per token) | 150 requests | 10 seconds |
Use backoff on 429.
JSON body (non-template)
Typical fields include from, to, subject, and text and/or html. Optional: category, custom_variables. Exact request bodies: [Transactional send](https://docs.mailtrap.io/developers/email-sending/transactional.md#post-api-send) and [Bulk send](https://docs.mailtrap.io/developers/email-sending/bulk.md#post-api-send).
Examples (curl)
Transactional send (send.api.mailtrap.io):
curl -X POST https://send.api.mailtrap.io/api/send \
-H "Authorization: Bearer $MAILTRAP_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"from": {"email": "[email protected]", "name": "Your App"},
"to": [{"email": "[email protected]"}],
"subject": "Hello",
"text": "Plain text body"
}'Bulk stream uses the same path and JSON shape on the bulk host (same env var; the token only needs bulk-stream scope):
curl -X POST https://bulk.api.mailtrap.io/api/send \
-H "Authorization: Bearer $MAILTRAP_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"from": {"email": "[email protected]", "name": "Your App"},
"to": [{"email": "[email protected]"}],
"subject": "Promotional",
"html": "<p>HTML body</p>"
}'Batch (array of messages; up to 500 per request — see API docs for full schema):
curl -X POST https://send.api.mailtrap.io/api/batch \
-H "Authorization: Bearer $MAILTRAP_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"messages":[{"from":{"email":"[email protected]"},"to":[{"email":"[email protected]"}],"subject":"One","text":"..."}]}'JSON body (template)
Use template_uuid and template_variables instead of raw text/html to use a template hosted by Mailtrap. Minimal example:
curl -X POST https://send.api.mailtrap.io/api/send \
-H "Authorization: Bearer $MAILTRAP_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"from": {"email": "[email protected]", "name": "Your App"},
"to": [{"email": "[email protected]"}],
"template_uuid": "your-template-uuid",
"template_variables": {"user_name": "Jane"}
}'Use the same API operations as non-template sends.
###
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- marketing-ideas – Đề xuất chiến lược marketing và ý tưởng tăng trưởng đã được kiểm chứng cho sản phẩm SaaS…
- marketing-mindset – Dùng khi người dùng hỏi cách có khách hàng đầu tiên, liệu làm X có cho ra Y không, cách…
- marketing-plan – Dùng khi người dùng cần một kế hoạch marketing toàn diện cho khách hàng, công ty họ tư…
- marketing-psychology – Áp dụng khoa học hành vi và mô hình tư duy vào quyết định marketing, được ưu tiên theo…
- micro-saas-launcher – Chuyên gia ra mắt nhanh các sản phẩm SaaS nhỏ, tập trung, theo cách tiếp cận của indie…
- monetization – Chiến lược và triển khai kiếm tiền cho sản phẩm số: Stripe, đăng ký thuê bao, thử nghiệm…
- nextjs-seo-indexing – Khắc phục lỗi lập chỉ mục SEO, vấn đề ngân sách thu thập dữ liệu và lỗi độ phủ trên…
- notion-template-business – Chuyên gia xây dựng và bán template Notion như một công việc kinh doanh, không chỉ làm…