Skip to content

Commit 8579d6b

Browse files
R44VC0RPcubic-dev-ai[bot]gabrielmfern
authored
feat(docs): add inbound integration page to documentation (#2594)
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: Gabriel Miranda <gabrielmfern@outlook.com>
1 parent c5c86d8 commit 8579d6b

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

apps/docs/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"pages": [
7979
"integrations/overview",
8080
"integrations/resend",
81+
"integrations/inbound",
8182
"integrations/nodemailer",
8283
"integrations/sendgrid",
8384
"integrations/postmark",

apps/docs/integrations/inbound.mdx

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
+title: 'Send (& receive) emails using Inbound'
3+
sidebarTitle: 'Inbound'
4+
+description: 'Learn how to send and receive emails using React Email and the Inbound 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/components](https://www.npmjs.com/package/@react-email/components) package and the [Inbound Node.js SDK](https://www.npmjs.com/package/inboundemail).
11+
12+
Make sure you have an account on [inbound](https://inbound.new?utm_source=react-email%20docs&utm_medium=email&utm_campaign=react_email_campaign), you will need an inbound API key.
13+
14+
<CodeGroup>
15+
16+
```sh npm
17+
npm install inboundemail @react-email/components
18+
```
19+
20+
```sh yarn
21+
yarn add inboundemail @react-email/components
22+
```
23+
24+
```sh pnpm
25+
pnpm add inboundemail @react-email/components
26+
```
27+
28+
```sh bun
29+
bun add inboundemail @react-email/components
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 * as React from 'react';
40+
import { Html, Button } from "@react-email/components";
41+
42+
export function Email(props) {
43+
const { url } = props;
44+
45+
return (
46+
<Html lang="en">
47+
<Button href={url}>Click me</Button>
48+
</Html>
49+
);
50+
}
51+
52+
export default Email;
53+
```
54+
55+
## 3. Send email
56+
57+
<Info>When integrating with other services, you need to convert your React template into HTML before sending. Inbound takes care of that for you. You can just directly pass the React template to the SDK.</Info>
58+
59+
Import the email template you just built and use the Inbound SDK to send it.
60+
61+
```tsx
62+
import { Inbound } from 'inboundemail';
63+
import { Email } from './email';
64+
65+
const inbound = new Inbound(process.env.INBOUND_API_KEY);
66+
67+
await inbound.emails.send({
68+
from: 'you@example.com',
69+
to: 'user@gmail.com',
70+
subject: 'hello world',
71+
react: <Email url="https://example.com" />,
72+
});
73+
```
74+
75+
## 4. Reply to an email
76+
77+
Use the Inbound SDK to reply to an email with the same template you just created.
78+
79+
```tsx
80+
import { Inbound } from 'inboundemail';
81+
import { Email } from './email';
82+
83+
const inbound = new Inbound({
84+
apiKey: process.env.INBOUND_API_KEY
85+
});
86+
87+
// sending an email via inbound
88+
await inbound.emails.send(email.id,{
89+
from: "React Email <react.email@inbound.new>",
90+
react: <Email url="https://example.com" />
91+
});
92+
93+
// replying to an email that was received via inbound
94+
await inbound.emails.reply(email.id,{
95+
from: "React Email <react.email@inbound.new>",
96+
react: <Email url="https://example.com" />
97+
});
98+
99+
100+
```
101+
102+
## Try it yourself
103+
104+
<Card
105+
title="Get started on Inbound"
106+
icon='arrow-up-right-from-square'
107+
iconType="duotone"
108+
href="https://inbound.new?utm_source=react-email%20docs&utm_medium=email&utm_campaign=react_email_campaign"
109+
>
110+
See it on our examples.
111+
</Card>

0 commit comments

Comments
 (0)