Send Better Auth emails from Loops
Call Loops from Better Auth’s email callbacks to send verification, password reset, magic link, and one-time code emails, each from its own Loops template.
sendResetPasswordsendVerificationEmailsendMagicLinksendVerificationOTPReset your password
Hi Sam, we got a request to reset your Acme password. Choose a new one with the button below.
Reset passwordEmail and password sign-in sends verification and password reset emails with the URL and token from Better Auth.
The magic link plugin’s sendMagicLink callback sends each link through your Loops template.
Email OTP covers sign in, email verification, and password reset, with the code in a data variable.
A small server helper sends each email with the Loops SDK. The docs include the full code.
Add the Loops JavaScript SDK with npm i loops, then set your API key and transactional IDs.
A helper calls sendTransactionalEmail. Keep it on the server so your API key stays private.
Which Better Auth emails can Loops send?
Verification and password reset emails for email and password sign-in, magic link emails, and email OTP codes for sign in, email verification, and password reset. Create a Loops transactional email for each one you use.
How does Better Auth call Loops?
Through the Loops JavaScript SDK. A server-side helper calls sendTransactionalEmail with a transactional ID, the user’s email address, and data variables, and each Better Auth callback calls that helper.
Do the data variable names matter?
They have to match. Names like verificationUrl, magicLinkUrl, and otpCode are suggestions, but the names in your Better Auth code and in your Loops emails must be the same.
Should the callbacks await the send?
Better Auth recommends not awaiting email sends in these callbacks, to reduce timing-attack risk and keep auth responses fast. The docs use void, or waitUntil if your platform supports background work.
Why aren’t my Better Auth emails sending?
Check that each transactional email is published, that its data variable names match your code, that the API key is valid and from the right account, and that your sending domain is verified.
Is there a free plan?
Yes. The free plan includes unlimited contacts and up to 4,000 emails to your first 1,000 contacts in any rolling 30-day window, marketing and transactional combined. Upgrade to send to more subscribed contacts.