LogoStarterkitpro
Features/Emails

Resend

Setting up and using Resend for sending emails.

While StarterKitPro uses Resend by default, you can integrate other email providers. However, an email service is necessary for features like Magic Links, transactional emails, etc.

Setup

  1. Create Account: Sign up for a new account on Resend.
  2. Add Domain: Navigate to the [Domains] section and click + Add Domain. It's highly recommended to use a subdomain (e.g., resend.yourdomain.com or mail.yourdomain.com) for better deliverability.
  3. Verify Domain: Follow the DNS verification steps provided by Resend. Once your DNS records are updated, click Verify DNS Records in the Resend dashboard (this might take a few minutes to propagate).
  4. Create API Key: Go to [API Keys] and click + Create API Key. Give it a recognizable name (e.g., YourAppName Production) and keep the default permissions. Click Add.
  5. Store API Key: Copy the generated API key immediately (it's shown only once!) and add it to your project's .env.local file (or your environment variable management system) as RESEND_API_KEY:
    .env.local
    AUTH_RESEND_KEY=re_xxxxxxxxxxxxxxxxxxxx

Configuration

Ensure your app-config.ts (or equivalent config file) reflects your Resend setup, particularly the from addresses and supportEmail:

lib/app-config.ts (snippet)
export const appConfig = {
  // ... other configs
  resend: {
    // Optional: Subdomain used for sending (matches DNS setup)
    subdomain: "resend",
    // Required: Sender for system emails (e.g., magic links)
    fromNoReply: `YourAppName <noreply@resend.yourdomain.com>`,
    // Required: Sender for other emails (e.g., marketing, updates)
    fromAdmin: `Your Name at YourAppName <yourname@resend.yourdomain.com>`,
    // Contact email for support replies
    supportEmail: "support@yourdomain.com",
  },
  // ... other configs
};

Critical Setup

Update fromNoReply, fromAdmin, and supportEmail with your actual domain and desired email addresses. The optional subdomain should match the domain/subdomain you verified in Resend and configured in your DNS.

Sending Emails

StarterKitPro typically uses a centralized function (e.g., sendEmail in lib/resend.ts) which utilizes the Resend API (via the resend npm package) to send emails composed with React Email.

Receiving Emails

Resend does not currently support receiving emails directly.

To handle replies, ensure the reply_to option is set correctly when sending emails. Our centralized sendEmail function usually handles this by setting reply_to to the supportEmail defined in your app-config.ts.

Checklist to Avoid Spam Folder (Resend)

  • Verified Domain: Ensure your sending domain/subdomain is fully verified in Resend.
  • Proper DNS: Correct SPF, DKIM, and DMARC records are essential (Resend guides you through this during domain setup).
  • Subdomain: Using a dedicated subdomain (like mail.yourdomain.com or resend.yourdomain.com) is strongly recommended for isolating email reputation.
  • Reputation: Maintain a good sender reputation by:
    • Sending relevant, expected content.
    • Managing bounces and complaints promptly.
    • Warming up new domains/IPs gradually if sending high volume.
  • Content: Avoid spammy content, excessive links, misleading subject lines, and large attachments.
  • List Hygiene: Regularly clean your email lists to remove inactive or invalid addresses.
  • Unsubscribe Link: Always include a clear and easy-to-use unsubscribe link.

On this page