Login
Docs
Emails

Emails

ZexaNext uses Resend for email service. Resend allows you to send emails using their APIs, add your domain, setup webhooks, send broadcast events and much more.

Resend has a pretty good free tier that allows you to send 3000 emails per month. If you need to send more emails, you can upgrade to a paid plan.

Setup

  1. Create a new account on Resend
  2. Click [Domains], then Add Domain and add your domain. It's recommended to use a subdomain like mail.yourdomain.com. Ref Why use a subdomain
  3. Add all the following DNS records (DKIM, SPF, DMARC) in your DNS settings page of the DNS provider. Once all are added, click the ”Verify Records” button above.
  4. Get you Resend API Key from the Resend dashboard and add it to the .env file.
    RESEND_API_KEY=your-api-key
  5. In @/lib/mail/resend.ts, update the from email address to your domain email address.
    from: "contact@mail.yourdomain.com"

Send Email

You can see the code to send an email using Resend in @/lib/mail/resend.ts.

This file implements a sendMail function that takes the email details as an argument and sends the email.

import { sendMail } from "./resend";

For expample, in @/lib/mail/index.ts, you can see the code to send verification emails and password reset emails.