# astro-email

> Integration for Astro to Generate HTML emails with React (react-email)

Latest version **0.19.0** (published 2025-10-13) · 0 weekly downloads

## Install

```sh
npm install astro-email
pnpm add astro-email
yarn add astro-email
bun add astro-email
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; low quality score; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.19.0 |
| Published | 2025-10-13 |
| First published | 2024-02-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 25 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Tim Havlicek |
| Maintainers | luckydye |

## Links

- npm: https://www.npmjs.com/package/astro-email
- Repository: https://github.com/luckydye/astro-email
- Homepage: https://github.com/luckydye/astro-email#readme
- Issues: https://github.com/luckydye/astro-email/issues
- npm.io page: https://npm.io/package/astro-email

## Dependencies (3)

- [@astrojs/react](https://npm.io/package/@astrojs/react.md) ^4.4.0
- [@vitejs/plugin-react](https://npm.io/package/@vitejs/plugin-react.md) ^4.7.0
- [@react-email/components](https://npm.io/package/@react-email/components.md) ^0.5.6

## Recent versions

- 0.19.0 (latest) — 2025-10-13
- 0.18.3 — 2025-10-10
- 0.18.2 — 2025-10-09
- 0.18.1 — 2025-10-09
- 0.18.0 — 2025-10-09
- 0.17.0 — 2025-10-09
- 0.16.0 — 2025-10-09
- 0.15.0 — 2025-09-23
- 0.14.0 — 2025-09-23
- 0.13.0 — 2025-09-22
- 0.12.0 — 2025-09-22
- 0.11.1 — 2025-09-22
- 0.11.0 — 2025-09-22
- 0.10.0 — 2025-09-22
- 0.9.0 — 2025-09-19
- … 13 more at https://npm.io/package/astro-email/versions

## README

# astro-email

Integration for Astro to Generate HTML emails with React ([react-email](https://github.com/resend/react-email)).

## Installation

```sh
npm i astro-email
```

## Usage

```javascript
import { defineConfig } from "astro/config";
import email from "astro-email";

// https://astro.build/config
export default defineConfig({
  integrations: [
    email({
      filename: "[name].html",
    }),
  ],
});
```

### Development

```sh
npx astro dev
```

Development preview with live reload.

### Production

```sh
npx astro build
```

This will generate HTML files for each `.astro` file in the `src/pages` directory.

## Example

```astro
---
// Important! Without partial astro will render the default Doctype.
export const partial = true;

import * as React from "react";
import { Body, Container, Heading, Link, Text } from "@react-email/components";
import Mail from "astro-email/Mail.astro";

const fontFamily =
  "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif";

const container: React.CSSProperties = {
  paddingLeft: "45px",
  paddingRight: "45px",
  margin: "0 auto",
  maxWidth: "640px",
};
---

<Mail>
  <Body
    style={{
      fontFamily,
      backgroundColor: "#ffffff",
      margin: "0",
    }}
  >
    <Container style={container}>
      <Heading>My Email</Heading>
      <Text>Lorem Ipsum</Text>

      <Link href="https://example.com">Click me</Link>
    </Container>
  </Body>
</Mail>

```

---
_Source: https://npm.io/package/astro-email · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
