# parse-email

> Parses mime-encoded email messages.

Latest version **1.0.0** (published 2018-05-09) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-05-09 |
| First published | 2018-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 2 |
| Unpacked size | 97 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Travis Fischer |
| Maintainers | fisch0920 |
| Keywords | parse, email, multipart |

## Links

- npm: https://www.npmjs.com/package/parse-email
- Repository: https://github.com/transitive-bullshit/parse-email
- npm.io page: https://npm.io/package/parse-email

## Dependencies (2)

- [ow](https://npm.io/package/ow.md) ^0.3.0
- [@nodemailer/mailparser2](https://npm.io/package/@nodemailer/mailparser2.md) ^1.0.3

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-05-09

## README

# parse-email

> Parses mime-encoded email messages.

[![NPM](https://img.shields.io/npm/v/parse-email.svg)](https://www.npmjs.com/package/parse-email) [![Build Status](https://travis-ci.com/transitive-bullshit/parse-email.svg?branch=master)](https://travis-ci.com/transitive-bullshit/parse-email) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)


## Install

```bash
npm install --save parse-email
```


## Usage

```js
const parse = require('parse-email')
const fs = require('fs')
const input = fs.readFileSync('./fixtures/0.txt', 'utf8')

parse(input)
  .then((email) => {
    console.log(email)
  })
```

Example parsed output:

```
{
  "attachments": [ ... ],
  "headers": { ... },
  "html": "<!DOCTYPE html>\n<html>...</html>",
  "text": "...",
  "textAsHtml": "<p>...</p>",
  "subject": "Example email subject",
  "date": "2018-05-09T14:17:02.000Z",
  "to": {
    "value": [
      {
        "address": "fischxxxx@gmail.com",
        "name": "Travis Fischer"
      }
    ],
    "html": "<span class=\"mp_address_name\">Travis Fischer</span> &lt;<a href=\"mailto:fischxxxx@gmail.com\" class=\"mp_address_email\">fischxxxx@gmail.com</a>&gt;",
    "text": "Travis Fischer <fischxxxx@gmail.com>"
  },
  "from": {
    "value": [
      {
        "address": "courses-xxxxxx@theblockchainacademy.com",
        "name": "Bryant Nielson"
      }
    ],
    "html": "<span class=\"mp_address_name\">Bryant Nielson</span> &lt;<a href=\"mailto:courses-xxxxxx@theblockchainacademy.com\" class=\"mp_address_email\">courses-xxxxxx@theblockchainacademy.com</a>&gt;",
    "text": "Bryant Nielson <courses-xxxxxx@theblockchainacademy.com>"
  },
  "messageId": "<01.B3.11399.xxxxxxxx@momentum1-mta1>"
}
```


## API

### parse(input)

Returns: `Promise<Object>`

Parses the given input string as a mime-encoded email.

#### input

Type: `String`
**Required**

Mime-encoded email string to parse.


## Related

- [@nodemailer/mailparser2](https://yarnpkg.com/en/package/@nodemailer/mailparser2) - Mail parser used under the hood.
- [@nodemailer/mailparser](https://github.com/nodemailer/mailparser) - Deprecated mail parser.
- [emailjs-mime-parser](https://github.com/emailjs/emailjs-mime-parser) - Parse a mime tree, no magic included.
- [nylas-mail](https://github.com/nylas/nylas-mail) - An extensible desktop mail app built on the modern web.


## License

Note: this module relies on [@nodemailer/mailparser2](https://yarnpkg.com/en/package/@nodemailer/mailparser2) which has a more restrictive license.

MIT © [Travis Fischer](https://github.com/transitive-bullshit)

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