Skip to content

feat(docs): Add IndiePitcher integration and example #1916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Emails built with React Email can be converted into HTML and sent using any emai
- [AWS SES](https://github.com/resend/react-email/tree/main/examples/aws-ses)
- [Plunk](https://github.com/resend/react-email/tree/main/examples/plunk)
- [Scaleway](https://github.com/resend/react-email/tree/main/examples/scaleway)
- [IndiePitcher](https://github.com/resend/react-email/tree/main/examples/indiepitcher)

## Support

Expand Down
79 changes: 79 additions & 0 deletions apps/docs/integrations/indiepitcher.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title: "Send email using IndiePitcher"
sidebarTitle: "IndiePitcher"
description: "Learn how to send an email using React Email and the IndiePitcher 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 [IndiePitcher Node.js SDK](https://www.npmjs.com/package/indiepitcher).

<CodeGroup>

```sh npm
npm install indiepitcher @react-email/components
```

```sh yarn
yarn add indiepitcher @react-email/components
```

```sh pnpm
pnpm add indiepitcher @react-email/components
```

</CodeGroup>

## 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 (
<Html lang="en">
<Button href={url}>Click me</Button>
</Html>
);
}

export default Email;
```

## 3. Convert to HTML and send email

Import the email template you just built, convert into an HTML string, and use the IndiePitcher SDK to send it.

```tsx
import { IndiePitcher } from 'indiepitcher';
import { render } from "@react-email/components";
import { Email } from "./email";

const indiePitcher = new IndiePitcher(process.env.INDIEPITCHER_API_KEY || '');

const emailHtml = await render(<Email url="https://example.com" />);

await indiePitcher.sendEmail({
to: '[email protected]',
subject: 'Hello world',
body: emailHtml,
bodyFormat: 'html',
});
```

## Try it yourself

<Card
title="IndiePitcher example"
icon="arrow-up-right-from-square"
iconType="duotone"
href="https://github.com/resend/react-email/tree/main/examples/indiepitcher"
>
See the full source code.
</Card>
3 changes: 2 additions & 1 deletion apps/docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
"integrations/postmark",
"integrations/aws-ses",
"integrations/mailersend",
"integrations/plunk"
"integrations/plunk",
"integrations/indiepitcher"
]
}
],
Expand Down
137 changes: 137 additions & 0 deletions examples/indiepitcher/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# react-email-with-indiepitcher

## 1.0.8

### Patch Changes

- @react-email/[email protected]

## 1.0.8-canary.1

### Patch Changes

- @react-email/[email protected]

## 1.0.8-canary.0

### Patch Changes

- @react-email/[email protected]

## 1.0.7

### Patch Changes

- @react-email/[email protected]

## 1.0.6

### Patch Changes

- @react-email/[email protected]

## 1.0.5

### Patch Changes

- @react-email/[email protected]

## 1.0.4

### Patch Changes

- Updated dependencies [467af4e]
- Updated dependencies [b34aa90]
- @react-email/[email protected]

## 1.0.4-canary.5

### Patch Changes

- Updated dependencies [467af4e]
- @react-email/[email protected]

## 1.0.4-canary.4

### Patch Changes

- @react-email/[email protected]

## 1.0.4-canary.3

### Patch Changes

- @react-email/[email protected]

## 1.0.4-canary.2

### Patch Changes

- @react-email/[email protected]

## 1.0.4-canary.1

### Patch Changes

- @react-email/[email protected]

## 1.0.4-canary.0

### Patch Changes

- Updated dependencies [f7833da]
- @react-email/[email protected]

## 1.0.3

### Patch Changes

- @react-email/[email protected]

## 1.0.2

### Patch Changes

- @react-email/[email protected]

## 1.0.1

### Patch Changes

- @react-email/[email protected]

## 1.0.1-canary.5

### Patch Changes

- @react-email/[email protected]

## 1.0.1-canary.4

### Patch Changes

- @react-email/[email protected]

## 1.0.1-canary.3

### Patch Changes

- @react-email/[email protected]

## 1.0.1-canary.2

### Patch Changes

- @react-email/[email protected]

## 1.0.1-canary.1

### Patch Changes

- @react-email/[email protected]

## 1.0.1-canary.0

### Patch Changes

- @react-email/[email protected]
25 changes: 25 additions & 0 deletions examples/indiepitcher/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "react-email-with-indiepitcher",
"version": "1.0.8",
"license": "MIT",
"private": true,
"sideEffects": false,
"type": "module",
"main": "./dist/index.js",
"files": ["dist/**"],
"scripts": {
"build": "tsup-node src/index.tsx --format esm --target node20",
"dev": "tsup-node src/index.tsx --format esm --target node20 --watch",
"clean": "rm -rf dist"
},
"dependencies": {
"indiepitcher": "1.4.0",
"@react-email/components": "workspace:0.0.33",
"react": "^19",
"react-dom": "^19"
},
"devDependencies": {
"tsup": "6.2.3",
"typescript": "4.8.3"
}
}
13 changes: 13 additions & 0 deletions examples/indiepitcher/src/email.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Button, Html } from '@react-email/components';

interface EmailProps {
url: string;
}

export const Email: React.FC<Readonly<EmailProps>> = ({ url }) => {
return (
<Html lang="en">
<Button href={url}>Click me</Button>
</Html>
);
};
14 changes: 14 additions & 0 deletions examples/indiepitcher/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { IndiePitcher } from 'indiepitcher';
import { render } from '@react-email/components';
import { Email } from './email';

const indiePitcher = new IndiePitcher(process.env.INDIEPITCHER_API_KEY || '');

const emailHtml = await render(<Email url="https://example.com" />);

await indiePitcher.sendEmail({
to: '[email protected]',
subject: 'Hello world',
body: emailHtml,
bodyFormat: 'html',
});
25 changes: 25 additions & 0 deletions examples/indiepitcher/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true,
"jsx": "react-jsx",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"module": "ESNext",
"target": "ESNext",
"types": ["vitest/globals"]
},
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}
28 changes: 28 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading