mailtrap-email-integration
यह क्या करती है
यह टूल Mailtrap सेवा का उपयोग करके आपकी ऐप से अपने-आप ईमेल भेजने में मदद करता है, जैसे साइनअप कन्फ़र्मेशन या पासवर्ड रीसेट ईमेल। इससे आपके टेस्ट ईमेल असली लोगों तक नहीं पहुँचते, और यह भी पक्का होता है कि आपके ग्राहकों को भेजे गए ईमेल सही तरह से काम करते हैं।
कब इस्तेमाल करें
- ✓जब आपको अपने-आप ईमेल भेजने हों (जैसे साइनअप कन्फ़र्मेशन)।
- ✓यह जाँचने के लिए कि टेस्ट ईमेल सही पहुँच रहे हैं या नहीं, बिना किसी को परेशान किए।
- ✓किसी प्रोजेक्ट में पहली बार ईमेल भेजने की सेटिंग करते समय।
Skill का लिंक
https://github.com/affaan-m/ECC/blob/main/skills/mailtrap-email-integration/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“Mailtrap Sandbox का उपयोग करके टेस्ट ईमेल भेजना कैसे सेट करूँ?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह टूल ईमेल भेजने के लिए Mailtrap API का उपयोग करता है। टेस्टिंग के लिए यह एक 'sandbox' का उपयोग करता है, जो भेजे गए ईमेल को अपने पास रख लेता है। असली ईमेल भेजने के लिए, आपके ईमेल डोमेन की पुष्टि होने के बाद एक अलग endpoint का उपयोग होता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Mailtrap Email Integration
Patterns for adding transactional email sending to an application using Mailtrap's Email API and Sandbox, covering authentication, environment separation, and common delivery pitfalls.
When to Activate
- Implementing a "send email" feature (signup confirmation, password reset, notifications, receipts)
- Debugging why emails aren't arriving in dev/staging
- Setting up a project's first email-sending integration
- Reviewing code that calls an email API directly without sandbox separation
Core Concepts
Sandbox vs. Production separation. Mailtrap provides a Sandbox API that captures emails without delivering them, used for dev/staging so test emails never reach real inboxes. Production sending uses a separate, verified-domain endpoint. Never point a dev environment at the production sending endpoint.
Authentication. Requests use a Bearer token in the Authorization header. Tokens are scoped per project; sandbox and production typically use different tokens.
Domain verification. Production sending requires verifying a sending domain via DNS records (SPF, DKIM, DMARC) before Mailtrap will deliver to real recipients. Skipping this causes silent delivery failures or spam-folder placement.
Code Examples
// Sending via Mailtrap's Email API (production)
async function sendEmail(to: string, subject: string, html: string) {
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: "no-reply@yourverifieddomain.com", name: "Your App" },
to: [{ email: to }],
subject,
html,
}),
});
if (!response.ok) {
throw new Error(`Email send failed: ${response.status}`);
}
return response.json();
}
// Same call, routed to Sandbox in non-production environments
const MAILTRAP_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}`;
Anti-Patterns
| Anti-Pattern | Why It's a Problem | Instead |
|---|---|---|
| Using the production sending endpoint in dev/test | Real test emails reach real inboxes, risking spam complaints and leaked test data | Route non-production environments to the Sandbox endpoint |
| Hardcoding API tokens in source | Credential leak risk if committed to version control | Load tokens from environment variables / secrets manager |
| Sending before domain verification completes | Emails silently fail or land in spam | Verify SPF/DKIM/DMARC records before enabling production sending |
| No retry/error handling on send failures | Silent notification failures (e.g., user never gets password reset email) | Check response status, log failures, surface actionable errors |
Best Practices
- Keep sandbox and production tokens in separate environment variables, never share one token across environments
- Verify sending domain DNS records before any production launch involving email
- Log delivery failures with enough context to debug (recipient, template, timestamp, response code)
- Treat email sending as a fallible network call: wrap in try/catch, never assume success
Related Skills
api-and-interface-design, security-and-hardening, ci-cd-and-automation
अक्सर पूछे जाने वाले सवाल
Mailtrap का 'Sandbox' क्या है?
यह एक टेस्टिंग वातावरण है जो इसके ज़रिए भेजे गए सभी ईमेल प्राप्त करता है, बिना उन्हें असली प्राप्तकर्ताओं तक पहुँचाए। बिना असली ईमेल भेजे टेस्ट करने के लिए यह सबसे अच्छा है।
मुझे अपना डोमेन सत्यापित (verify) क्यों करना होगा?
असली ग्राहकों को ईमेल भेजने के लिए Mailtrap को यह पक्का करना होता है कि ईमेल जिस डोमेन से आ रहे हैं, वह आपका ही है। इससे स्पैम रोकने में मदद मिलती है।
API 'tokens' क्या होते हैं?
ये एक तरह के गुप्त पासवर्ड जैसे होते हैं, जिन्हें आपकी ऐप Mailtrap से सुरक्षित तरीके से बात करने के लिए इस्तेमाल करती है। हर environment (टेस्टिंग और प्रोडक्शन) का अपना अलग token होना चाहिए।
जानकारी
लेखक का मूल विवरण
Guides agents through integrating transactional email sending via Mailtrap's Email API, including sandbox testing, domain verification, and API authentication. Use when implementing email-sending features, debugging delivery issues, or setting up safe dev/staging email testing.
repo: affaan-m/ECC
लोकप्रियता
- GitHub स्टार
- 280k
- रैंकिंग में स्थान
- #354
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
accessibility
280kयह आपके एजेंट को ऐसे इंटरफ़ेस बनाने में मदद करता है जिन्हें हर कोई इस्तेमाल कर सके। यह पक्का करता है कि वेबसाइट और ऐप दिव्यांग लोगों के लिए भी अच्छे से काम करें, जैसे नेत्रहीन या जिन्हें चलने-फिरने में दिक्कत होती है।
agent-architecture-audit
280kयह आपके एजेंट को जाँचने देता है कि सब कुछ सही से चल रहा है। यह AI सिस्टम में समस्याएँ ढूँढकर ठीक करता है, ताकि वे उम्मीद के मुताबिक काम करें।
agent-eval
280kयह आपके एजेंट को अलग-अलग AI coding tools की तुलना करने में मदद करता है। यह मापता है कि किसी खास काम के लिए कौन सा टूल ज़्यादा तेज़, सस्ता और भरोसेमंद है।
agent-harness-construction
280kयह आपके एजेंट को काम कैसे करना है, यह बेहतर समझने में मदद करता है। यह उन tools और instructions को बेहतर बनाता है जिनका एजेंट इस्तेमाल करता है, ताकि उसकी सफलता की संभावना बढ़े।
मिलती-जुलती skills
shopify
260kआपके एजेंट को Shopify GraphQL API से स्टोर का डेटा पढ़ने और अपडेट करने देती है, जैसे उत्पाद, स्टॉक, ऑर्डर और ग्राहक।
rest-graphql-debug
260kआपके एजेंट को REST या GraphQL API कॉल क्यों विफल होती है, यह पता करने में मदद करती है, कनेक्शन, लॉगिन, अनुरोध फ़ॉर्मैट और जवाब को एक-एक परत करके जाँचते हुए।
har-derived-api-client
260kआपके एजेंट को किसी वेबसाइट के नेटवर्क ट्रैफ़िक को एक बार रिकॉर्ड करके सीधा API क्लाइंट बनाने देती है, ताकि हर बार पेज पर क्लिक करना न पड़े।