{"library":"postal-mime","title":"Email MIME Parser","description":"postal-mime is a robust and zero-dependency JavaScript library designed for parsing raw email messages in RFC822 format into a structured object. It operates effectively across Node.js, browser environments (including Web Workers), and serverless platforms like Cloudflare Email Workers. The library is currently stable at version 2.7.4, with a recent release cadence suggesting active maintenance and bug fixes, typically every few weeks or months. Key differentiators include its full TypeScript support, comprehensive handling of complex MIME structures (multipart messages, nested parts, attachments), built-in security limits to prevent Denial-of-Service attacks from malformed emails, and strict adherence to RFC 2822/5322 email standards. It differentiates itself by offering broad environment compatibility without external dependencies, making it a lightweight and versatile choice for email processing.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install postal-mime"],"cli":null},"imports":["import PostalMime from 'postal-mime';","const PostalMime = require('postal-mime');","import PostalMime from './node_modules/postal-mime/src/postal-mime.js';","import type { Email } from 'postal-mime';","import { addressParser } from 'postal-mime';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import PostalMime from 'postal-mime';\nimport type { Email, PostalMimeOptions } from 'postal-mime';\nimport util from 'node:util';\n\nasync function parseEmail() {\n    const options: PostalMimeOptions = {\n        attachmentEncoding: 'base64'\n    };\n\n    const rawEmail = `Subject: My awesome email 🤓\\nContent-Type: text/html; charset=utf-8\\n\\n<p>Hello world 😵‍💫</p>`;\n\n    const email: Email = await PostalMime.parse(rawEmail, options);\n\n    console.log(`Parsed Subject: ${email.subject}`);\n    console.log('Full Parsed Email Structure:');\n    // Use 'util.inspect' for pretty-printing in Node.js\n    console.log(util.inspect(email, false, 22, true));\n}\n\nparseEmail().catch(console.error);","lang":"typescript","description":"Demonstrates parsing a basic email string with subject and HTML content, applying options, and logging the structured output using TypeScript in a Node.js environment.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}