@dyanet/imap — MIME header parsing

Paste raw email headers below. The RFC 2822 unfolding, RFC 2047 encoded-word decoding and Content-Type parsing all run in your browser, using this library's own parsing code.

Raw headers

Folded continuation lines and =?charset?B?…?= / =?charset?Q?…?= encoded words are both handled.

parseHeaders()

Unfolded, lower-cased keys, encoded words decoded.

decodeEncodedWords()

Just the RFC 2047 layer, shown line by line.

parseContentType()

Splits the media type from its parameters — the boundary token is what drives multipart splitting.

Test it against a real mailbox

This page only exercises the parsers. To drive the actual IMAP client against your own inbox, use the example app — it's what we test the library with.

📹 A video walkthrough is coming. Until then the steps below are the complete path.

1 · Get the example app running

git clone https://github.com/dyanet/imap.git
cd imap/examples/gmail-viewer
npm install
cp .env.example .env
npm run dev

Then open http://localhost:3000. You need two values in .env: GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET.

2 · Gmail

In the Google Cloud Console: enable the Gmail API, then create an OAuth client ID → Web application with http://localhost:3000/callback as an authorised redirect URI. Paste the two values into .env and sign in.

Prefer to skip the app entirely? Gmail still accepts app passwords for IMAP once 2-Step Verification is on — point the library at imap.gmail.com:993 with password set and you're connected in about five lines.

3 · Outlook / Microsoft 365

App passwords no longer work for Outlook. Microsoft finished disabling Basic Authentication for IMAP during 2026; app passwords depended on it and cannot be regenerated. OAuth2 is the only way in, so use the library's xoauth2 option with an access token from Microsoft Entra ID (delegated permission IMAP.AccessAsUser.All). Host is outlook.office365.com:993 for work accounts, imap-mail.outlook.com:993 for personal ones.

The example app itself is Gmail-only as shipped — its OAuth flow is hard-coded to Google's endpoints. The library underneath is provider-agnostic; see the README for the Outlook config.