Closed mikroskeem closed 1 year ago
Please share some of your code. It works perfectly for me. Make sure you using it in an async function with await before rendering.
An example of it:
async function renderEmail() { html = await render({ template: Receipt, props: { firstName: 'John' } }); }
In the README you have this as an example:
const emailHtml = render({
component: Hello,
props: {
name: 'Svelte'
}
});
But it should be this:
const emailHtml = render({
template: Hello,
props: {
name: 'Svelte'
}
});
@jakedickerson good catch. PR to update readme was merged. https://github.com/carstenlebek/svelte-email/pull/3
@carstenlebek this issue can be closed
@carstenlebek this issue can be closed
in some parts of the docs its still component
like in https://svelte-email.vercel.app/docs/integrations/aws-ses
I managed to get it working by going through new documentation - moved rendering to server side and now it works.
https://github.com/carstenlebek/svelte-email/blob/1e43a93941bc63b21ac0a390bfceb700c6205030/src/lib/render.ts#L17-L19
Excerpt of package.json
```json { "devDependencies": { "@sveltejs/adapter-auto": "^2.0.0", "@sveltejs/kit": "^1.5.0", "@typescript-eslint/eslint-plugin": "^5.45.0", "@typescript-eslint/parser": "^5.45.0", "eslint": "^8.28.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-svelte3": "^4.0.0", "prettier": "^2.8.0", "prettier-plugin-svelte": "^2.8.1", "svelte": "^3.54.0", "svelte-check": "^3.0.1", "tslib": "^2.4.1", "typescript": "^4.9.3", "vite": "^4.0.0", "svelte-email": "^0.0.4" } } ```