Skip to content

Commit 1fe4b90

Browse files
feat(integrations): add Mailchimp Transactional docs (#3766)
Co-authored-by: Felipe Freitag <felipe.freitag@resend.com>
1 parent bdfdff2 commit 1fe4b90

3 files changed

Lines changed: 92 additions & 1 deletion

File tree

‎apps/docs/docs.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@
126126
"integrations/eusend",
127127
"integrations/brevo",
128128
"integrations/mailtrap",
129-
"integrations/zeptomail"
129+
"integrations/zeptomail",
130+
"integrations/mailchimp-transactional"
130131
]
131132
},
132133
{
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: "Send email using Mailchimp Transactional"
3+
sidebarTitle: "Mailchimp Transactional"
4+
description: "Learn how to send an email using React Email and the Mailchimp Transactional 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 [Mailchimp Transactional Node.js SDK](https://www.npmjs.com/package/@mailchimp/mailchimp_transactional).
11+
12+
<CodeGroup>
13+
14+
```sh npm
15+
npm install @mailchimp/mailchimp_transactional react-email
16+
```
17+
18+
```sh yarn
19+
yarn add @mailchimp/mailchimp_transactional react-email
20+
```
21+
22+
```sh pnpm
23+
pnpm add @mailchimp/mailchimp_transactional react-email
24+
```
25+
26+
```sh bun
27+
bun add @mailchimp/mailchimp_transactional react-email
28+
```
29+
30+
</CodeGroup>
31+
32+
## 2. Create an email using React
33+
34+
Start by building your email template in a `.jsx` or `.tsx` file.
35+
36+
```tsx email.tsx
37+
import { Button, Html } from "react-email";
38+
39+
interface EmailProps {
40+
url: string;
41+
}
42+
43+
export function Email({ url }: EmailProps) {
44+
return (
45+
<Html lang="en">
46+
<Button href={url}>Click me</Button>
47+
</Html>
48+
);
49+
}
50+
```
51+
52+
## 3. Convert to HTML and send email
53+
54+
Import the email template you just built, convert into an HTML string, and use the Mailchimp Transactional SDK to send it.
55+
56+
```tsx
57+
import mailchimpTransactional from "@mailchimp/mailchimp_transactional";
58+
import { render } from "react-email";
59+
import { Email } from "./email";
60+
61+
const mailchimp = mailchimpTransactional(process.env.MAILCHIMP_API_KEY || "");
62+
63+
const emailHtml = await render(<Email url="https://example.com" />);
64+
65+
await mailchimp.messages.send({
66+
message: {
67+
subject: "Hello world",
68+
from_email: "hello@example.com",
69+
to: [{ email: "hello@example.com", type: "to" }],
70+
html: emailHtml,
71+
},
72+
});
73+
```
74+
75+
## Try it yourself
76+
77+
<Card
78+
title="Mailchimp Transactional example"
79+
icon="arrow-up-right-from-square"
80+
iconType="duotone"
81+
href="https://github.com/resend/react-email/tree/main/examples/mailchimp-transactional"
82+
>
83+
See the full source code.
84+
</Card>

‎apps/docs/snippets/integrations.mdx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,10 @@
4747
<Card title="ZeptoMail" href="/integrations/zeptomail">
4848
Send email using ZeptoMail
4949
</Card>
50+
<Card
51+
title="Mailchimp Transactional"
52+
href="/integrations/mailchimp-transactional"
53+
>
54+
Send email using Mailchimp Transactional
55+
</Card>
5056
</CardGroup>

0 commit comments

Comments
 (0)