Send Welcome Email to New Users
Good to know
This feature is available from version v2.2.0. Please refer to the changelog for upgrade instructions. For usage of the
referral
field, please read Track User Source.
Sending welcome emails to new users is a crucial part of product marketing. Nexty provides complete new user welcome email functionality and universal email templates.
Since Supabase Auth doesn't provide an independent registration flow or corresponding registration event flags, Nexty determines whether a user is new by checking if the referral
field exists in the login callback method app/auth/callback/route.ts
.
The specific mechanism works as follows: Each user's source information is recorded during their first login. When a user visits and logs in through a URL with parameters, the referral
field records the URL parameters. If they visit and log in through a URL without parameters, the referral
field is recorded as direct
. Therefore, when the referral
field is empty, it indicates the user's first login.
Based on this mechanism, we can trigger the sending of new user welcome emails in app/auth/callback/route.ts
.
Setup Steps
- Design Welcome Email Template
The built-in new user welcome email template is located at emails/user-welcome.tsx
. All brand information is extracted from the config/site
configuration. You only need to modify the config/site
configuration to get a basic welcome email template, as shown below:

It's recommended to design your welcome email template to better match your marketing needs based on your business characteristics.
Attention
Since email sending is a server-side task, the following client-side component usage cannot be used here:
- Next.js
<Link/>
or<Image />
components- TailwindCSS styling syntax
- Icon libraries like Lucide
- Configure Environment Variables
Set the environment variable NEXT_PUBLIC_USER_WELCOME
to true
- Test the Feature
Since this flow only sends welcome emails to new users, testing requires first deleting existing test users, then logging in again on the page:
