본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)280k · #354

mailtrap-email-integration

하는 일

이 도구는 회원가입 확인이나 비밀번호 재설정 같은 이메일을 Mailtrap 서비스를 통해 애플리케이션에서 자동으로 보내도록 돕습니다. 테스트 이메일이 실제 사람에게 닿지 않도록 하고, 고객에게 보내는 이메일이 제대로 작동하는지 확인합니다.

사용하는 경우

  • ✓회원가입 확인처럼 자동 이메일을 보내야 할 때.
  • ✓테스트 이메일이 다른 사람을 방해하지 않고 제대로 도착하는지 확인할 때.
  • ✓프로젝트에서 처음으로 이메일 발송을 설정할 때.

스킬 링크

https://github.com/affaan-m/ECC/blob/main/skills/mailtrap-email-integration/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/affaan-m/ECC/blob/main/skills/mailtrap-email-integration/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Mailtrap Sandbox를 사용해 테스트 이메일을 보내려면 어떻게 설정하나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 Mailtrap API를 사용해 이메일을 보냅니다. 테스트에는 이메일을 받아 보관하는 '샌드박스'를 사용하고, 실제 이메일에는 발신 도메인을 인증한 뒤 다른 엔드포인트를 사용합니다.

기술 내용 (원본 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'는 무엇인가요?

여기서 보낸 모든 이메일을 실제 수신자에게 전달하지 않고 받는 테스트 환경입니다. 실제 이메일을 보내지 않고 시험하기에 이상적입니다.

도메인을 왜 인증해야 하나요?

실제 고객에게 이메일을 보내려면 Mailtrap이 이메일이 나가는 도메인을 사용자가 소유하고 있음을 확인해야 합니다. 이는 스팸을 막는 데 도움이 됩니다.

API '토큰'이란 무엇인가요?

애플리케이션이 Mailtrap과 안전하게 통신하기 위해 쓰는 비밀번호 같은 것입니다. 각 환경(테스트와 운영)은 각자의 토큰을 가져야 합니다.

상세 정보

작성자의 원본 설명

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
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬