Email Setup
Configure transactional email for AuthCore without breaking static builds or hosted deployments.
Why this matters
AuthCore's email helpers now lazy-load nodemailer and reuse any transporter you provide. That means Next.js static exports, Render builds, and other CI environments can import AuthCore safely even when SMTP credentials are absent. When you supply credentials at runtime, AuthCore creates the transporter on demand and caches it for subsequent sends.
Required packages
Install nodemailer in your application. AuthCore lists it as an optional peer dependency so you can omit it when you rely on third-party providers, but most setups will want it available:
Environment variables
Choose either the direct SMTP credentials or the service shortcut shown below. Both will produce the same transporter.
SMTP credentials
Service shortcut
Tip: When using services such as Resend, Postmark, or AWS SES, prefer the SMTP credentials they expose. AuthCore will adopt any hostname and port you provide.
Runtime verification
After setting environment variables, run the snippet below from a terminal, seed script, or integration test. It uses the built-in emailService
so you verify exactly what AuthCore will execute.
If the transporter cannot be created, the helper logs a warning instead of throwing. Double-check your credentials and confirm nodemailer loaded correctly in the runtime (serverless functions may require bundler externals).
Render deployment checklist
Render builds pull your docs from the DOCS
folder and perform a static export. Use the following build command and keep email variables in the Runtime Environment tab so the transporter initializes only after deployment.
- Leave email variables empty during the build step if you only need static exports. AuthCore no longer crashes when they are undefined.
- Set the variables in Render's runtime environment to enable password reset, verification, and waitlist flows once the app boots.
- If you wire a custom transporter, export it from
config/nodemailer.js
and AuthCore will reuse it automatically.
Custom transporter advanced tip
You can return your own transporter (for example, one that proxies to a queue or a third-party SDK) by exporting an ensureTransporter
function from config/nodemailer.js
. AuthCore calls it before attempting to import nodemailer.