Skip to content

Commit 378f75e

Browse files
feat(integrations): add Sendora docs and example (#3928)
Co-authored-by: Felipe Freitag <felipe.freitag@resend.com>
1 parent 2781ba8 commit 378f75e

7 files changed

Lines changed: 171 additions & 1 deletion

File tree

‎apps/docs/docs.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@
128128
"integrations/mailtrap",
129129
"integrations/zeptomail",
130130
"integrations/mailchimp-transactional",
131-
"integrations/rasket"
131+
"integrations/rasket",
132+
"integrations/sendora"
132133
]
133134
},
134135
{

‎apps/docs/integrations/sendora.mdx‎

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
title: "Send email using Sendora"
3+
sidebarTitle: "Sendora"
4+
description: "Learn how to send an email using React Email and the Sendora Node.js SDK."
5+
"og:image": "https://react.email/static/covers/react-email.png"
6+
---
7+
8+
## 1. Install dependencies
9+
10+
Get the [react-email](https://www.npmjs.com/package/react-email) package and the [Sendora Node.js SDK](https://www.npmjs.com/package/@sendora/sdk).
11+
12+
Make sure you have an account on [Sendora](https://sendorahq.com), you will need a server key and a verified sending domain.
13+
14+
<CodeGroup>
15+
16+
```sh npm
17+
npm install @sendora/sdk react-email
18+
```
19+
20+
```sh yarn
21+
yarn add @sendora/sdk react-email
22+
```
23+
24+
```sh pnpm
25+
pnpm add @sendora/sdk react-email
26+
```
27+
28+
```sh bun
29+
bun add @sendora/sdk react-email
30+
```
31+
32+
</CodeGroup>
33+
34+
## 2. Create an email using React
35+
36+
Start by building your email template in a `.jsx` or `.tsx` file.
37+
38+
```tsx email.tsx
39+
import { Button, Html } from "react-email";
40+
41+
interface EmailProps {
42+
url: string;
43+
}
44+
45+
export function Email({ url }: EmailProps) {
46+
return (
47+
<Html lang="en">
48+
<Button href={url}>Click me</Button>
49+
</Html>
50+
);
51+
}
52+
```
53+
54+
## 3. Convert to HTML and send email
55+
56+
Import the email template you just built, convert it into HTML and plain text, and use the Sendora SDK to send both.
57+
58+
<Info>While you develop, use the key of a Sendora test server. Sendora checks and logs each email sent with it, but delivers none.</Info>
59+
60+
```tsx
61+
import { Sendora } from "@sendora/sdk";
62+
import { render, toPlainText } from "react-email";
63+
import { Email } from "./email";
64+
65+
const sendora = new Sendora({ token: process.env.SENDORA_API_TOKEN });
66+
67+
const html = await render(<Email url="https://example.com" />);
68+
69+
await sendora.email.send({
70+
from: "you@example.com",
71+
to: ["user@gmail.com"],
72+
subject: "hello world",
73+
html,
74+
text: toPlainText(html),
75+
});
76+
```
77+
78+
## Try it yourself
79+
80+
<Card
81+
title="Sendora example"
82+
icon="arrow-up-right-from-square"
83+
iconType="duotone"
84+
href="https://github.com/resend/react-email/tree/main/examples/sendora"
85+
>
86+
See the full source code.
87+
</Card>

‎apps/docs/snippets/integrations.mdx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,7 @@
5656
<Card title="Rasket" href="/integrations/rasket">
5757
Send email using Rasket
5858
</Card>
59+
<Card title="Sendora" href="/integrations/sendora">
60+
Send email using Sendora
61+
</Card>
5962
</CardGroup>

‎examples/sendora/package.json‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "react-email-with-sendora",
3+
"license": "MIT",
4+
"private": true,
5+
"sideEffects": false,
6+
"type": "module",
7+
"main": "./dist/index.js",
8+
"files": [
9+
"dist/**"
10+
],
11+
"scripts": {
12+
"build": "tsdown src/index.tsx --format esm --target node20",
13+
"dev": "tsdown src/index.tsx --format esm --target node20 --watch",
14+
"clean": "rm -rf dist"
15+
},
16+
"dependencies": {
17+
"@sendora/sdk": "5.6.1",
18+
"react-email": "6.0.3",
19+
"react": "19.2.4",
20+
"react-dom": "19.2.4"
21+
},
22+
"devDependencies": {
23+
"tsdown": "0.21.9",
24+
"typescript": "5.9.3"
25+
}
26+
}

‎examples/sendora/src/email.tsx‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Button, Html } from 'react-email';
2+
3+
interface EmailProps {
4+
url: string;
5+
}
6+
7+
export const Email: React.FC<Readonly<EmailProps>> = ({ url }) => {
8+
return (
9+
<Html lang="en">
10+
<Button href={url}>Click me</Button>
11+
</Html>
12+
);
13+
};

‎examples/sendora/src/index.tsx‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Sendora } from '@sendora/sdk';
2+
import { render, toPlainText } from 'react-email';
3+
import { Email } from './email';
4+
5+
const sendora = new Sendora({ token: process.env.SENDORA_API_TOKEN });
6+
7+
const html = await render(<Email url="https://example.com" />);
8+
9+
await sendora.email.send({
10+
from: 'you@example.com',
11+
to: ['user@gmail.com'],
12+
subject: 'hello world',
13+
html,
14+
text: toPlainText(html),
15+
});

‎examples/sendora/tsconfig.json‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"compilerOptions": {
3+
"composite": false,
4+
"declaration": true,
5+
"declarationMap": true,
6+
"esModuleInterop": true,
7+
"forceConsistentCasingInFileNames": true,
8+
"inlineSources": false,
9+
"isolatedModules": true,
10+
"moduleResolution": "node",
11+
"noUnusedLocals": false,
12+
"noUnusedParameters": false,
13+
"preserveWatchOutput": true,
14+
"skipLibCheck": true,
15+
"strict": true,
16+
"strictNullChecks": true,
17+
"jsx": "react-jsx",
18+
"lib": ["ESNext", "DOM", "DOM.Iterable"],
19+
"module": "ESNext",
20+
"target": "ESNext",
21+
"types": ["vitest/globals"]
22+
},
23+
"include": ["."],
24+
"exclude": ["dist", "build", "node_modules"]
25+
}

0 commit comments

Comments
 (0)