Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Email parser for browser and serverless environments
| Date | Stars |
|---|---|
| 2026-07-24 | 546 |
| 2026-07-25 | 546 |
| 2026-07-28 | 546 |
| 2026-07-30 | 546 |
| 2026-08-06 | 546 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# postal-mime
**postal-mime** is an email parsing library for Node.js, browsers (including Web Workers), and serverless environments (like Cloudflare Email Workers). It takes in a raw email message (RFC822 format) and outputs a structured object containing headers, recipients, attachments, and more.
> [!TIP]
> PostalMime is developed by the makers of [EmailEngine](https://emailengine.app/?utm_source=github&utm_campaign=imapflow&utm_medium=readme-link)—a self-hosted email gateway that provides a REST API for IMAP and SMTP servers and sends webhooks whenever something changes in registered accounts.
## Features
- **Browser & Node.js compatible** - Works in browsers, Web Workers, Node.js, and serverless environments
- **TypeScript support** - Fully typed with comprehensive type definitions
- **Zero dependencies** - No external dependencies
- **RFC compliant** - Follows RFC 2822/5322 email standards
- **Handles complex MIME structures** - Multipart messages, nested parts, attachments
- **Security limits** - Built-in protection against deeply nested messages and oversized headers
> [!NOTE]
> Full documentation is available at [postal-mime.postalsys.com](https://postal-mime.postalsys.com/).
## Table of Contents
- [Source](#source)
- [Demo](#demo)
- [Installation](#installation)
- [Usage](#usage)
- [Browser](#browser)
- [Node.js](#nodejs)
- [Cloudflare Email Workers](#cloudflare-email-workers)
- [TypeScript Support](#typescript-support)
- [API](#api)
- [PostalMime.parse()](#postalmimeparse)
- [Utility Functions](#utility-functions)
- [addressParser()](#addressparser)
- [decodeWords()](#decodewords)
- [License](#license)
---
## Source
The source code is available on [GitHub](https://github.com/postalsys/postal-mime).
## Demo
Try out a live demo using the [example page](https://postal-mime.postalsys.com/demo).
## Installation
Install the module from npm:
```bash
npm install postal-mime
```
## Usage
You can import the `PostalMime` class differently depending on your environment:
### Browser
To use PostalMime in the browser (including Web Workers), import it from the `src` folder:
```js
import PostalMime from './node_modules/postal-mime/src/postal-mime.js';
const email = await PostalMime.parse(`Subject: My awesome email 🤓
Content-Type: text/html; charset=utf-8
<p>Hello world 😵💫</p>`);
console.log(email.subject); // "My awesome email 🤓"
```
<details>
<summary><strong>TypeScript</strong></summary>
```typescript
import PostalMime from './node_modules/postal-mime/src/postal-mime.js';
import type { Email } from 'postal-mime';
const email: Email = await PostalMime.parse(`Subject: My awesome email 🤓
Content-Type: text/html; charset=utf-8
<p>Hello world 😵💫</p>`);
console.log(email.subject); // "My awesome email 🤓"
```
</details>
### Node.js
In Node.js (including serverless functions), import it directly from `postal-mime`:
```js
import PostalMime from 'postal-mime';
import util from 'node:util';
const email = await PostalMime.parse(`Subject: My awesome email 🤓
Content-Type: text/html; charset=utf-8
<p>Hello world 😵💫</p>`);
// Use 'util.inspect' for pretty-printing
console.log(util.inspect(email, false, 22, true));
```
<details>
<summary><strong>TypeScript</strong></summary>
```typescript
import PostalMime from 'postal-mime';
import type { Email, PostalMimeOptions } from 'postal-mime';
import util from 'node:util';
const options: PostalMimeOptions = {
attachmentEncoding: 'base64'
};
const email: Email = await PostalMime.parse(`Subject: My awesome email 🤓
Content-Type: text/html; charset=utf-8
<p>Hello world 😵💫</p>`, options);
// Use 'util.inspect' for pretty-printing
console.log(util.inspect(email, false, 22, true));
```
</details>
### CommonJS
For projects using CommonJS (with `require()`), postal-mime automatically provides the CommonJS build:
```js
const PostalMime = require('postal-mime');
const { addressParser, decExcerpt of 13,079 characters
Read on GitHub140
37
4
1
1
1
1
1
1
1
1
1
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:5050218cfc74f5ad, topic:serverless