Features
Emails
Send transactional emails with mailgun.
Helper Functions
Access helper functions by importing from $lib/emails
send()
addToMailingList()
Send Transactional Emails
You can send transactional emails using Templates or Text/HTML Strings.
Send with Templates
Templates live in $lib/emails
. You can create new templates by creating a new svelte file in the $lib/emails/templates
folder. This will be automatically imported for you by doing so.
Use: Just pass the file name as the template param as shown below.
Template Metadata
Template metadata is an object
where your key
names match your template props.
Send with Text/HTML Strings
Creating Templates
Templates can be created using Svelte components
or HTML
. You can even use tailwindcss
classes to style your templates. svelte-5-email
also includes some components you can use, but they are completely optional.
Changing Mail Providers
Step 1
Create a client in `$lib/server`
Instantiate your providers client in a file called
yourProviderClient.js
;Step 2
Edit `api/emails/send/+server.js`
Change the function below to match your provider.
Step 3
Edit `api/emails/mailing-lists/+server.js`
Change the function below to match your provider.