Skip to main content

Mail Service Reference

MailService (libs/api/mail/src/lib/mail.service.ts) sends all transactional emails via Nodemailer.

Available Methods

MethodSubject lineTrigger
sendVerificationEmail(to, url)Verify your emailBetter Auth sign-up
sendPasswordResetEmail(to, url)Reset your passwordBetter Auth password reset
sendEmailChangeVerification(to, url)Verify your new emailNot called internally — available for custom use
sendProfileChangeConfirmation(to, url, newName, newNickname)Confirm your profile changerequest-profile-change
sendEmailChangeConfirmationToOldEmail(to, url, newEmail)Confirm your email changerequest-email-change (step 1)
sendEmailChangeVerificationToNewEmail(to, url)Verify your new email addressrequest-email-change (step 2)
sendPasswordChangeConfirmation(to, url)Confirm your password changerequest-password-change

SMTP Environment Variables

VariableRequiredDefaultNotes
SMTP_HOSTHostname of the SMTP server
SMTP_PORT25Integer
SMTP_SECUREfalseSet 'true' to enable TLS
SMTP_USEROmit for anonymous relay
SMTP_PASSRequired when SMTP_USER is set
SMTP_FROMSender address shown in emails

Local Development

Point SMTP_HOST and SMTP_PORT at a local mail sink (for example smtp4dev). The sink captures all outgoing emails without delivering them. You can then inspect the confirmation links in the sink's UI.

The project's local mail sink API is available at http://127.0.0.1:50463/api.

tip

Use the local smtp4dev instance or the repo mail-sink helper to poll messages and extract confirmation links from HTML email bodies.