Better Auth's emails, sent by Notix.
Better Auth does not send email itself: it calls functions you provide when a user needs a verification link or a password reset. Each of those functions is a notix-js send, so every authentication email goes through your verified domain.
Send an email from Better Auth.
import { betterAuth } from "better-auth";
import { Notix } from "notix-js";
const notix = new Notix(process.env.NOTIX_API_KEY!);
const from = "Acme <accounts@acme.com>";
export const auth = betterAuth({
emailAndPassword: {
enabled: true,
sendResetPassword: async ({ user, url }) => {
await notix.emails.send({ from, to: user.email, subject: "Reset your password", html: `<a href="${url}">Reset your password</a>` });
},
},
emailVerification: {
sendVerificationEmail: async ({ user, url }) => {
await notix.emails.send({ from, to: user.email, subject: "Confirm your email", html: `<a href="${url}">Confirm your email</a>` });
},
},
});
The from address must be on a domain you have verified in Notix. Step by step: the Node.js quickstart and the longer guide to sending email from Node.js.
One API key, kept on the server.
Create an API key on the API keys page of the Notix console and store it as NOTIX_API_KEY in the server environment, beside BETTER_AUTH_SECRET. Read it only in code that runs on the server, never in anything shipped to a browser.
A Send only key is enough for code that only sends: if it leaks, it cannot read your contacts or delete a domain.
NOTIX_API_KEY=notix_xxxxxxxxxxxx
NOTIX_WEBHOOK_SECRET=whsec_xxxxxxxxxxxx
Questions, answered.
Where does Better Auth send its emails from?
Should a failed send stop the sign-up?
Why is my send refused with a from-address error?
Send your first email in five minutes.
Verify a domain, copy an API key, make one call. The free plan does not ask for a card.