Better Auth sends verification and password-reset mail by calling functions you pass in its options. In current Better Auth, emailVerification.sendVerificationEmail and emailAndPassword.sendResetPassword each receive { user, url, token }. Send that url with the SendPanda SDK. There is no SMTP setting to fill in.
1. Install
npm install @sendpanda/sdkCreate a Send emails key and store it as SENDPANDA_API_KEY. The from address has to be on a domain verified in that project. See domain setup. A queued status means the API accepted the email, not that the recipient's server delivered it.
2. Send from the two callbacks
import { betterAuth } from "better-auth";
import { SendPanda } from "@sendpanda/sdk";
const panda = new SendPanda(process.env.SENDPANDA_API_KEY!);
async function send(to: string, subject: string, url: string, key: string) {
await panda.emails.send(
{
from: "Your app <hello@your-verified-domain.com>",
to: [to],
subject,
text: url,
html: `<p><a href="${url}">${subject}</a></p>`,
},
{ idempotencyKey: key },
);
}
export const auth = betterAuth({
emailVerification: {
sendVerificationEmail: async ({ user, url, token }) => {
await send(user.email, "Confirm your email", url, `verify-${token}`);
},
},
emailAndPassword: {
enabled: true,
sendResetPassword: async ({ user, url, token }) => {
await send(user.email, "Reset your password", url, `reset-${token}`);
},
},
});The token is the idempotency key, so a retried callback does not send a second copy of the same link. Better Auth only calls these after it has decided the address. If the project already uses the resend package inside these callbacks, the migration guide shows the RESEND_BASE_URL switch for that package.