Build Resend
NOT REALLYreplaces $20/mosaves $240/yrback to the verdict
Not an email provider: deliverability is reputation, not code. This is the mail module that makes the provider replaceable: one interface, an SMTP driver, a hosted-API driver, a dev driver that writes .eml files, DNS records checked, bounces suppressed, and an honest page on self-hosting Postal if you insist.
Before step 1
Everything below is assumed from the first step. Tick each one when you actually have it, not when you plan to.
- installfree
Why Everything in this build runs on it: the server, the scripts, the tests.
Get it Download the LTS installer from nodejs.org, or install with your package manager (brew install node, or nvm install 22). Restart the terminal afterwards. open ↗
Verify
node --version prints v22 or higher - installfree
Why Every step below is a command you type or a file you edit.
Get it VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal. open ↗
Verify
You can open a folder and run a command in its terminal - installfree
Why History for your code, and the way most hosts deploy.
Get it Install from git-scm.com or with your package manager, then run git init in the project folder once it exists. open ↗
Verify
git --version prints a version - accountfree on a domain you own
Why SPF, DKIM and DMARC records are what make mail deliverable.
Get it Use a subdomain like mail.yourdomain.com so experiments never hurt your main domain's reputation.
- API keyfree tier; then usage-based
Why The hosted driver. Free tiers cover thousands of emails a month.
Get it Resend: resend.com > API Keys > Create; add and verify your domain. Postmark: account > Servers > API Tokens. open ↗
- API keyvaries
Why The SMTP driver, for self-hosting or another provider.
Get it From any mail host.
- have readyfree
Why Deliverability is judged by real providers.
Get it Free accounts.
Environment variables
These go in a .env file the app reads at startup. The pack's .env.example is this table as a file · copy it, never commit the filled-in version.
| Variable | Needed | Example | Where the value comes from |
|---|---|---|---|
MAIL_DRIVER | required | dev | dev, smtp or resend. |
MAIL_FROM | required | 'Your App' <hello@mail.yourdomain.com> | From address on your verified domain. |
RESEND_API_KEYsecret | optional | re_... | Resend dashboard. |
SMTP_URLsecret | optional | smtps://user:pass@host:465 | For the SMTP driver. |
MAIL_DEV_DIR | optional | ./mail-out | Where the dev driver writes .eml files. |
The build, in order
The interface and two local drivers
send() with a typed result; dev writes files; SMTP sends for real.
- terminal
mkdir mail && cd mail && git init && npm init -y && npm pkg set type=module && npm install nodemailer@6 mkdir -p mail-out && cp .env.example .env
done when · tick each as it passesThe hosted driver
The records
Bounces and suppression
Self-host option, honestly
Operateproduct builder
Watch bounces and complaints like a provider would.
done when · tick each as it passes
That is the whole plan for Resend. What it deliberately does not cover is below · check the gaps before you call it a replacement.
- Being a mail provider. Inbox placement is earned with volume history you do not have.
- deliverability built on years of provider relationships
- bounce, complaint and suppression handling
- the dashboard, logs and webhooks
- not being the person who debugs Gmail rejections at 2am
- Templates with a preview page
- A Postmark driver
Need the files? The project pack on the verdict page hands your agent the whole brief · more email.