Email
Resend Setup
Resend is used to send email notifications. Currently it powers the contact form — when a user submits a message on /contact, an email is forwarded to your inbox so you never miss it.
Get Your API Key
- Sign up at resend.com (free tier: 100 emails/day, 3,000/month)
- Go to API Keys in the dashboard
- Click Create API Key, give it a name (e.g.
pay4saas), select Sending access, Add, and copy the key
Environment Variables
Add the following to your .env.local:
RESEND_API_KEY=re_xxxxx
CONTACT_NOTIFY_EMAIL=you@example.com| Variable | Description |
|---|---|
RESEND_API_KEY | Your Resend API key (starts with re_) |
CONTACT_NOTIFY_EMAIL | The email address that receives contact form notifications |
How It Works
- User submits the /contact form
- The message is saved to the
contact_messagestable in Supabase - An email notification is sent to
CONTACT_NOTIFY_EMAILvia Resend (non-blocking — if the email fails, the form submission still succeeds)
The email sending logic is in lib/email.ts.
Custom Domain (Optional)
By default, emails are sent from onboarding@resend.dev. To send from your own domain:
- Go to Domains in the Resend dashboard
- Add your domain and follow the DNS verification steps (add the TXT and MX records)
- Once verified, update the
fromfield inlib/email.ts:
from: 'Pay4SaaS <onboarding@resend.dev>',
from: 'Pay4SaaS <noreply@yourdomain.com>', Testing
After configuring the environment variables, restart the dev server and submit a test message on /contact. You should receive the notification email within seconds.
If the email doesn't arrive, check:
RESEND_API_KEYis correctCONTACT_NOTIFY_EMAILis set- Server logs for
[Email]prefixed messages