
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
email-forward-parser
Advanced tools
Parses forwarded emails and extracts original content.
This library supports most common email clients and locales.
😘 Maintainer: @eliottvincent
![]() |
Crisp |
👋 You use this library and you want to be listed there? Contact us.
This library is used at Crisp everyday with around 1 million inbound emails.
const EmailForwardParser = require("email-forward-parser");
const result = new EmailForwardParser().read(MY_EMAIL_STRING);
console.log(result.forwarded);
// true
read(body, subject)
checks whether an email was forwarded or not, and parses its original content (From, To, Cc, Subject, Date and Body):
body
must be a string representing the email body (as returned by mailparser, for example)subject
must be a string representing the email subject. This parameter is optional, but recommended to improve the detection for some email clients (especially New Outlook 2019)const EmailForwardParser = require("email-forward-parser");
const result = new EmailForwardParser().read(MY_EMAIL_STRING, MY_SUBJECT_STRING);
console.log(result);
// {
// forwarded: true,
//
// message: "Praesent suscipit egestas hendrerit.",
//
// email: {
// body: "Aenean quis diam urna.",
//
// from: {
// address: "john.doe@acme.com",
// name: "John Doe"
// },
// to: [{
// address: "bessie.berry@acme.com",
// name: "Bessie Berry"
// }],
// cc: [{
// address: "walter.sheltan@acme.com",
// name: "Walter Sheltan"
// }],
//
// subject: "Integer consequat non purus",
// date: "25 October 2021 at 11:17:21 EEST"
// }
// }
Email forwarding (i.e. when you manually forward a copy of an email by clicking the "Forward" button in your email client) is not standardized by any RFC. Meaning that email clients are free to format the forwarded email the way they want.
There is no magic bullet to handle such disparities. The only viable solution is to rely on regular expressions (a lot!), to account for each email client's specificities:
Client | Detectable via subject | Detectable via separator | Subject localized | Separator localized | All original information available | Original information localized | Other specificities |
---|---|---|---|---|---|---|---|
Apple Mail | Yes | Yes | Yes | Yes | Yes | Yes | -- |
Gmail | Yes | Yes | No | No | Yes | Only some parts | -- |
Outlook Live / 365 | Yes | Yes | Yes | No | Yes | No | -- |
Outlook 2013 | Yes | No | ? | -- | ? | ? | -- |
Outlook 2019 | Yes | Yes | No | Yes | No | Yes | The From and Date parts (only original information available) are embedded in the separator, rather than the body itself |
New Outlook 2019 | Yes | No | Yes | -- | Yes | Yes | -- |
Yahoo Mail | Yes | Yes | No | Yes | Yes | Yes | The original information are all stuck to each other, without line breaks |
Thunderbird | Yes | Yes | No | Yes | Yes | Yes | -- |
Missive | Yes | Yes | No | No | Yes | No | -- |
HubSpot | Yes | Yes | Yes | Yes | Yes | Yes | -- |
IONOS by 1 & 1 | ? | Yes | ? | ? | Yes | ? | -- |
MailMate | Yes | Yes | ? | ? | Yes | ? | -- |
Feel free to fork this project and submit fixes. We may adapt your code to fit the codebase.
You can run unit tests using:
npm test
email-forward-parser is released under the MIT License. See the bundled LICENSE file for details.
FAQs
Parses forwarded emails and extract content
The npm package email-forward-parser receives a total of 3,228 weekly downloads. As such, email-forward-parser popularity was classified as popular.
We found that email-forward-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.