KO
베타 번역

@core / email

1.0.4 ▾
인증됨MIT
GitHub

타입이 지정된 React Email 템플릿의 트랜잭션 이메일: Resend, SMTP, 개발 시 콘솔

코드파일 9개컨텍스트약 683토큰검사 통과

설치

$genpm add @core/email

포함 내용

  • src/lib/email/에 소스 코드, 파일 9개. (12.9kB)
  • src/lib/email/AGENTS.md에 AI 규칙, 그리고 IDE 규칙 파일.
  • .env.example에 추가되는 환경 변수: RESEND_API_KEY, EMAIL_FROM, APP_NAME.

README

@core/email

genpm license

Transactional email with typed React Email templates: Resend, SMTP or console in dev

A GenPM module: source code + AI rules + MCP config, injected into your project instead of hidden in node_modules. The code lands in src/lib/email, pinned to a verified commit, and you own it.

Install

genpm add @core/email

No genpm yet? curl -fsSL https://genpm.net/install.sh | sh (macOS/Linux), irm https://genpm.net/install.ps1 | iex (Windows), or one-off with npx @genpm-net/cli add @core/email.

Or let your AI agent do it: run genpm mcp setup once, then ask "add @core/email with genpm" in Claude Code, Cursor, VS Code, Windsurf, Codex or Gemini CLI. It shows you a dry-run plan before writing anything.

What it does

Transactional email with typed templates: sendEmail('welcome', { to, props }). Providers: Resend (default), SMTP (optional, via nodemailer) and a console provider for development. Templates use React Email. No marketing lists, no queues, no tracking pixels.

Setup

After genpm add, follow these steps (your AI agent finds the same steps in src/lib/email/AGENTS.md and can do them for you):

  1. Env: EMAIL_FROM ("App <hello@yourdomain.com>") and RESEND_API_KEY (verify the domain in Resend first). Without RESEND_API_KEY, outside production, emails are printed to the console. In production (next start) that fallback throws so mail is never lost silently; set EMAIL_PROVIDER=console to print them there too (local tests). Optional APP_NAME: brand name shown in the email layout (default App). @types/react is only needed at build time: move it to devDependencies if GenPM added it to dependencies. SMTP instead: EMAIL_PROVIDER=smtp, SMTP_URL=smtps://user:pass@host:465 and install nodemailer.
  2. Send from server code only:
    import { sendEmail } from './lib/email/index.ts';
    await sendEmail('welcome', { to: user.email, props: { name: user.name, appUrl: 'https://app.example.com' } });
  3. With @core/auth (≥ 1.1.0): send welcome from its onLogin hook when isNewUser is true:
    app.route('/auth', authRoutes({
      onLogin: ({ user, isNewUser }) =>
        isNewUser && user.email ? sendEmail('welcome', { to: user.email, props: { name: user.name, appUrl: process.env.APP_URL ?? '' } }).then(() => undefined) : undefined,
    }));
  4. Verify: run the app without RESEND_API_KEY and check the console output.

What's inside

Paths are relative to src/lib/email.

  • index.ts — public API: sendEmail, renderEmail, setEmailProvider, provider factories, TemplateProps.
  • send.ts — the template registry (templates) and sendEmail.
  • templates/*.ts — welcome, magicLink, receipt, plus the shared layout.ts.
  • providers.ts — EmailProvider interface and implementations.

At a glance

  • npm dependencies (proposed, never installed without asking): resend, @react-email/components, @react-email/render, react, @types/react
  • Environment variables (added to .env.example): RESEND_API_KEY, EMAIL_FROM, APP_NAME
  • AI rules: AGENTS.md, loaded by your agent only when it works in src/lib/email

Security

GenPM installs a 40-character commit SHA (never a branch), verifies an Ed25519-signed manifest, never runs install scripts and scans AI rules for prompt injection. Details: genpm.net/docs/security.

License

MIT — see LICENSE. Browse the full catalog at genpm.net.

@core/email 신고

패키지를 신고하려면 GitHub로 로그인하세요.