parse-multipart-mixed-mail-pmb

Split a 'Content-Type: multipart/mixed' email into parsed headers and body parts.

Usage no npm install needed!

<script type="module">
  import parseMultipartMixedMailPmb from 'https://cdn.skypack.dev/parse-multipart-mixed-mail-pmb';
</script>

README



parse-multipart-mixed-mail-pmb

Split a 'Content-Type: multipart/mixed' email into parsed headers and body parts.

API

This module exports one function, which carries another function:

parseMail(raw[, opt])

raw should be a Buffer or "binary" (latin-1) String. Its API is the same as splitParseHeaders() from parse-mail-attachment-pmb, except that body will be an array of raw body parts as produced by .splitBody(). Use splitParseHeaders() or parseAttachment() to process them further.

opts is an optional options object that supports these keys:

  • acceptJustText (default: false): If truthy, and the Content-Type starts with text/, rather than lamenting that it's not a multipart mail, consider the entire mail as its first (and only) body part.

.splitBody(raw)

raw should be a Buffer or "binary" (latin-1) String. Split just the body parts, and return them, as an array of Buffers. Assumes the first line of raw is a boundary.

Known issues

  • Needs more/better tests and docs.

 

License

ISC