diff --git a/apps/docs/docs.json b/apps/docs/docs.json index 153cee03bc..89b8c30f91 100644 --- a/apps/docs/docs.json +++ b/apps/docs/docs.json @@ -77,6 +77,7 @@ "pages": [ "integrations/overview", "integrations/resend", + "integrations/inbound", "integrations/nodemailer", "integrations/sendgrid", "integrations/postmark", diff --git a/apps/docs/integrations/inbound.mdx b/apps/docs/integrations/inbound.mdx new file mode 100644 index 0000000000..f01c52b72d --- /dev/null +++ b/apps/docs/integrations/inbound.mdx @@ -0,0 +1,99 @@ +--- +title: 'Send (& recieve) emails using Inbound' +sidebarTitle: 'Inbound' +description: 'Learn how to send and recieve emails using React Email and the Inbound Node.js SDK.' +'og:image': 'https://react.email/static/covers/react-email.png' +--- + +## 1. Install dependencies + +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). + +Make sure you have an account on [inbound](https://inbound.new), you will need an inbound API key. + + + +```sh npm +npm install inboundemail @react-email/components +``` + +```sh yarn +yarn add inboundemail @react-email/components +``` + +```sh pnpm +pnpm add inboundemail @react-email/components +``` + +```sh bun +bun add inboundemail @react-email/components +``` + + + +## 2. Create an email using React + +Start by building your email template in a `.jsx` or `.tsx` file. + +```tsx email.tsx +import * as React from 'react'; +import { Html, Button } from "@react-email/components"; + +export function Email(props) { + const { url } = props; + + return ( + + + + ); +} + +export default Email; +``` + +## 3. Send email + +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. + +Import the email template you just built and use the Inbound SDK to send it. + +```tsx +import { Inbound } from 'inboundemail'; +import { Email } from './email'; + +const inbound = new Inbound(process.env.INBOUND_API_KEY); + +await inbound.emails.send({ + from: 'you@example.com', + to: 'user@gmail.com', + subject: 'hello world', + react: , +}); +``` + +## 4. Reply to an email + +Use the Inbound SDK to reply to an email with the same template you just created. + +```tsx +import { Inbound } from 'inboundemail'; +import { Email } from './email'; + +const inbound = new Inbound(process.env.INBOUND_API_KEY); + +await inbound.emails.reply(email.id,{ + react: , +}); +``` + +## Try it yourself + + + See the full source code. +