nodemailer/mailparser

Decode mime formatted e-mails

JavaScript

1,670

391 commits

updated Oct 10, 2026

See the code

README

mailparser

Nodemailer

[!IMPORTANT] This module is in maintenance mode. It will continue to receive security updates and critical bug fixes, but no new features or feature changes will be added. For new projects, please consider using PostalMime, which works in both Node.js and browser environments.

Advanced email parser for Node.js. Everything is handled as a stream which should make it able to parse even very large messages (100MB+) with relatively low overhead.

Installation

First install the module from npm:

$ npm install mailparser

next import the mailparser object into your script:

const mailparser = require('mailparser');

Usage

See mailparser homepage for documentation and terms.

Limits

  • simpleParser replaces cid: image references in the HTML with data: URLs. The total length of the URLs written into the HTML is capped by the maxInlinedImagesSize option (default 20 MB, counted in characters of the inserted URLs). References past the cap stay as cid: links. The same cap applies to URLs returned from a custom updateImageLinks() callback.
  • simpleParser calls its callback, or settles its promise, exactly once. When MailParser reports a non-fatal error (for example HTML longer than maxHtmlLengthToParse), that error is what the caller receives. MailParser itself still emits the 'error' event and then finishes parsing.

License

Licensed under MIT

mailparser
mime

nodemailer/mailparser

Decode mime formatted e-mails

JavaScript

1,670

391 commits

updated Oct 10, 2026

See the code

README

mailparser

Nodemailer

[!IMPORTANT] This module is in maintenance mode. It will continue to receive security updates and critical bug fixes, but no new features or feature changes will be added. For new projects, please consider using PostalMime, which works in both Node.js and browser environments.

Advanced email parser for Node.js. Everything is handled as a stream which should make it able to parse even very large messages (100MB+) with relatively low overhead.

Installation

First install the module from npm:

$ npm install mailparser

next import the mailparser object into your script:

const mailparser = require('mailparser');

Usage

See mailparser homepage for documentation and terms.

Limits

  • simpleParser replaces cid: image references in the HTML with data: URLs. The total length of the URLs written into the HTML is capped by the maxInlinedImagesSize option (default 20 MB, counted in characters of the inserted URLs). References past the cap stay as cid: links. The same cap applies to URLs returned from a custom updateImageLinks() callback.
  • simpleParser calls its callback, or settles its promise, exactly once. When MailParser reports a non-fatal error (for example HTML longer than maxHtmlLengthToParse), that error is what the caller receives. MailParser itself still emits the 'error' event and then finishes parsing.

License

Licensed under MIT

mailparser
mime

Project health

Overall

5.5/10

Maintained

10/10

Code review

0/10
OpenSSF Scorecard

Latest release

3.9.38 · Oct 10, 2026

Releases this year

40

Significant stargazers

Keith Cirkel

1,809 followers · starred Apr 2014

Andreas Lind

131 followers · starred Oct 2010

William Desportes

269 followers · starred Sep 2026

Aslak Hellesøy

819 followers · starred Oct 2010