Write your email
Create a new file called Create a new file called
test-email.svelte in your emails folder.test-email.ts in your emails folder.Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Learn how to use Svelte Email to build beautiful email templates
Install Svelte email components
npm install svelte-email
Write your email
test-email.svelte in your emails folder.<script lang="ts">
export let name: string;
</script>
<Html>
<Head />
<Preview>Welcome to Svelte Email</Preview>
<Body>
<Container>
<h1>Welcome, {name}!</h1>
<p>Thanks for trying Svelte Email. We're thrilled to have you on board.</p>
</Container>
</Body>
</Html>
test-email.ts in your emails folder.
export function renderEmail(name: string) {
return render({
template: TestEmail,
props: {
name,
},
});
}
Write your workflow
export const testWorkflow = workflow('test-workflow', async ({ step, payload }) => {
await step.email('send-email', async (controls) => {
return {
subject: controls.subject,
body: renderEmail(payload.userName),
};
},
{
controlSchema: z.object({
subject: z.string().default('A Successful Test on Novu from {{userName}}'),
}),
});
}, {
payloadSchema: z.object({
userName: z.string().default('John Doe'),
}),
});
Was this page helpful?