Just Launch It

Just
Launch
It

Features Emails

Just Launch It helps you get up and running with emails in an instant. This can be useful to send all kinds of transactional mail to your users.

Setup

1. Sign up for a free Resend account at resend.com.
2. After signing up and confirming your email, head to resend.com/domains to add your domain. Follow the instructions to verify your domain by adding the DNS records.
3. It is also recommended to add an additional DNS record specifying your DMARC policy. This can help improve deliverability.

DNS

1TXT | _dmarc.yourdomain.com | v=DMARC1; p=none
4. After verifying your domain, create a new API key at resend.com/api-keys.
Add your newly provisioned API key to your .env file.

.env

1RESEND_API_KEY=...
5. Edit your email sending settings in /src/lib/just-launch-it.config.ts to set your default email from name and address. You must send from a domain that is already verified in your Resend account.

Sending emails

Just Launch It comes with an email template for sending a confirmation email for newly registered users (when using the email/password method). This can serve as a starting template to continue setting up your transactional emails and is located in /src/lib/emails/ConfirmAccount.svelte.
Under the hood, the package Svelte Email is being used to create beautiful and compliant email templates with ease.
Finally, to actually send your emails, call the Resend SDK with your template:

src/routes/auth/register.ts

 1import { resend } from '$lib/server/email/resend';
 2import { render } from "svelte-email";
 3import ConfirmAccount from "$lib/emails/ConfirmAccount.svelte";
 4import justLaunchItConfig from "$lib/just-launch-it.config";
 5
 6// ...
 7
 8// Send an email to the user
 9resend.emails.send({
10    from: `${justLaunchItConfig.email.fromName} <${justLaunchItConfig.email.fromEmail}>`,
11    to: 'your-users-email-address-here',
12    subject: 'Confirm your account',
13    html: render({
14        template: ConfirmAccount,
15        props: {
16            // Any props required to render the ConfirmAccount template
17        }
18    }),
19    text: `Confirm your account`,
20    headers: {
21        // Optional headers, the below prevents grouping of emails in Gmail
22        'X-Entity-Ref-ID': randomUUID() 
23    }
24});