Coder Social home page Coder Social logo

crisp-oss / email-reply-parser Goto Github PK

View Code? Open in Web Editor NEW
86.0 7.0 34.0 297 KB

๐Ÿ”Ž Node library for parsing plain text email content.

Home Page: https://www.npmjs.com/package/email-reply-parser

License: MIT License

JavaScript 100.00%
email parser

email-reply-parser's Introduction

Email Reply Parser

Test and Build Build and Release NPM Downloads

Email Reply Parser is a node library to parse plain-text email replies and extract content

This library supports most email replies, signatures and locales.

๐Ÿ˜˜ Maintainer: @baptistejamin

Who uses it?

Crisp

๐Ÿ‘‹ You use this library and you want to be listed there? Contact us.

Installation

Install the project using NPM:

npm install --save email-reply-parser

Features

This library is used at Crisp everyday with around 1 million inbound emails. Over the years, we improved this library so it can work with most emails.

  • Strip email replies like On DATE, NAME <EMAIL> wrote:
  • Supports around 10 locales, including English, French, Spanish, Portuguese, Italian, Japanese, Chinese.
  • Removes signatures like Sent from my iPhone
  • Removes signatures like Best wishes

Usage

var EmailReplyParser = require("email-reply-parser");

var email =  new EmailReplyParser().read(MY_EMAIL_STRING);

console.log(email.getVisibleText());

Contributing

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

Credits

License

email-reply-parser is released under the MIT License. See the bundled LICENSE file for details.

email-reply-parser's People

Contributors

baptistejamin avatar davidfurlong avatar dependabot[bot] avatar eliottvincent avatar fredericbarthelet avatar jag-upfort avatar reptoxx avatar valeriansaliou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

email-reply-parser's Issues

Issue with parsing Samsung reply

When trying to parse this:

This is pretty awesome, nice work!Sent from my Verizon, Samsung Galaxy smartphone
-------- Original message --------From...

(I excluded the quoted reply, but it is there)

I would expect the output to be:

This is pretty awesome, nice work!

But instead I get the whole text.

I'm not sure what you can do about the Sent from... part because you probably don't want to cut off sentences that just happen to start with "Sent from". But I think you can add optional spaces to the regex and remove the end of line requirement like so:

/^-{1,10} ?Original message ?-{1,10}/

To at least handle the reply.

getting invalid ELF header error in amazon lambda

I am deploying a super simple lambda function using serverless.
When I am invoking the function, I get the following error:

{
    "errorType": "Error",
    "errorMessage": "/var/task/node_modules/re2/build/Release/re2.node: invalid ELF header",
    "trace": [
        "Error: /var/task/node_modules/re2/build/Release/re2.node: invalid ELF header",
        "    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18)",
        "    at Module.load (internal/modules/cjs/loader.js:950:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
        "    at Module.require (internal/modules/cjs/loader.js:974:19)",
        "    at require (internal/modules/cjs/helpers.js:101:18)",
        "    at Object.<anonymous> (/var/task/node_modules/re2/re2.js:3:13)",
        "    at Module._compile (internal/modules/cjs/loader.js:1085:14)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
        "    at Module.load (internal/modules/cjs/loader.js:950:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:790:12)"
    ]
}

Any idea, how I can resolve the issue as email-reply-parser is the only library is using the re2.node

Thanks in advance

Improve regexes?

Hi I noticed that your regexes use "{0,1}" which is the equivalent to "?" - Is there any reason on why to use this notation instead of a "?"?

Update re2 for node 18

Hi there! Node 18 becomes the LTS version today. Could re2 please be updated to support node 18? The pinned version used by this library doesn't have a version built for node 18

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.