Emailing
The Emailing module in CodebaseUp is powered by SendGrid and utilizes the React Email library. This combination allows for seamless and efficient handling of email communications within your application.
Prerequisites:
- Create a Sendgrid account docs
- Add the following environment variables to your
.env.local
file and deployment settings:
SENDGRID_API_KEY=
EMAIL_SERVER_USER=
EMAIL_SERVER_PASSWORD=$SENDGRID_API_KEY
EMAIL_SERVER_HOST=
EMAIL_SERVER_PORT=
EMAIL_FROM=
Configurations:
- Emails:
/packages/emailing/emails
- Sendgrid:
packages/emailing/sendgrid/index.ts
Usage:
- Magic Link authentication docs:
apps/web/lib/auth.tsx
- check out thesendVerificationRequest
function which has been designed in a way to support multilingual email communications
How to reach inboxes instead of spam folders?
-
Complete sender authentication (domain authentication) on Sendgrid link. You'll need to add CNAME records to your DNS host (where you bought your domain).
-
Add
_dmarc
as extra TXT record to improve deliverability link:v=DMARC1;p=none;rua=mailto:dmarc@yourdomain.com;ruf=mailto:dmarc@yourdomain.com;rf=afrf;pct=100
-
(Optional) Warm up your email address(es) with Instantly. When your domain is brand new without any reputation with email providers, emails are more prone to end up in spam. Warming up your email address helps tackle this initial problem. I've tested a few warmup tools and Instantly seems to be the simplest and for $30 / month offers warmups for unlimited email accounts.