Skip to content

Latest commit

Β 

History

History
87 lines (62 loc) Β· 2.2 KB

File metadata and controls

87 lines (62 loc) Β· 2.2 KB

@simplens/resend

Resend email provider plugin for SimpleNS.

Features

  • πŸ“§ Send HTML emails via Resend
  • πŸ–ΌοΈ Automatic base64 image extraction to CID attachments
  • πŸ”„ Template variable replacement ({{var}}, ${var}, {var}, $var)
  • ⚑ Built-in rate limiting (configurable)
  • βœ… Full TypeScript support

Installation

npm install @simplens/resend

Configuration

Add to your simplens.config.yaml or generate using npx @simplens/config-gen gen @simplens/resend:

providers:
  - package: '@simplens/resend'
    id: email-resend
    credentials:
      RESEND_API_KEY: ${RESEND_API_KEY}
      FROM_EMAIL: ${FROM_EMAIL}
    options:
      rateLimit:
        maxTokens: 100      # Max emails in bucket
        refillRate: 100     # Tokens refilled per interval
        refillInterval: day # second | minute | hour | day

Required Credentials

Credential Description
RESEND_API_KEY Your Resend API key (get one here)
FROM_EMAIL Verified sender email address (verify domain)

Notification Schema

Field Type Required Description
channel 'email' βœ… Must be 'email'
recipient.user_id string βœ… User identifier
recipient.email string βœ… Valid email address
content.subject string βœ… Email subject line
content.html string βœ… HTML content (must contain at least one HTML tag)
variables Record<string, unknown> ❌ Template variables

Rate Limiting

Resend free tier allows 100 emails/day. Configure based on your plan:

Plan Suggested Config
Free maxTokens: 100, refillRate: 100, refillInterval: day
Pro maxTokens: 5000, refillRate: 5000, refillInterval: day

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Manual test (requires .env with RESEND_API_KEY, FROM_EMAIL, TO_EMAIL)
npm run test:send

License

MIT

Author

SimpleNS Team