Giter VIP home page Giter VIP logo

eml-parser's People

Contributors

ankit1329 avatar dependabot[bot] avatar jfvanin avatar skempin 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

Watchers

 avatar  avatar

eml-parser's Issues

getEmailAsHtml() => Cannot read property 'html' of undefined

Hi,

First thank your for your tool.

Error recorded
We trigger an exception using EmlParser(readable).getEmailAsHtml(), the exception : Cannot read property 'html' of undefined at /home/node/app/node_modules/eml-parser/index.js:87:50.

Context
The email corresponding to the eml was sent without destination (to) only carbon copy (cc). I didn't know this was possible but i succeed to send one like that.

Solution :
The fix look quite simple : just add a condition wrapping the "To : " statement in the html template like you did for cc.

Thanks for your time.

Exposing Config options?

Hi, thanks very much for providing this project to the public.

We found the following config in your source, which is sent to html-pdf.

 let options = {
    orientation: 'landscape'
};

We were looking for a way to adapt it, but now a question popped up:
Is there a reason why you hardcoded it to landscape and not exposing it as a config option to users of this library?

Thanks in advance!

Not working with next js 13.x

error node_modules/eml-parser/index.js (23:17) @ EmlParser

  • error Error [ReferenceError]: EmlParser is not defined
    at eval (webpack-internal:///(rsc)/./node_modules/eml-parser/index.js:17:28)
    at (rsc)/./node_modules/eml-parser/index.js (/home/arsl/WebstormProjects/visualprooffrontend/.next/server/app/api/uploadSingleEmail/route.js:6702:1)
    at webpack_require (/home/arsl/WebstormProjects/visualprooffrontend/.next/server/webpack-runtime.js:33:43)
    at eval (webpack-internal:///(rsc)/./app/api/uploadSingleEmail/route.js:8:68)
    at (rsc)/./app/api/uploadSingleEmail/route.js (/home/arsl/WebstormProjects/visualprooffrontend/.next/server/app/api/uploadSingleEmail/route.js:440:1)
    at webpack_require (/home/arsl/WebstormProjects/visualprooffrontend/.next/server/webpack-runtime.js:33:43)
    at eval (webpack-internal:///(rsc)/./node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fapi%2FuploadSingleEmail%2Froute&page=%2Fapi%2FuploadSingleEmail%2Froute&appPaths=&pagePath=private-next-app-dir%2Fapi%2FuploadSingleEmail%2Froute.js&appDir=%2Fhome%2Farsl%2FWebstormProjects%2Fvisualprooffrontend%2Fapp&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&rootDir=%2Fhome%2Farsl%2FWebstormProjects%2Fvisualprooffrontend&isDev=true&tsconfigPath=tsconfig.json&basePath=&assetPrefix=&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!:16:140)
    at (rsc)/./node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fapi%2FuploadSingleEmail%2Froute&page=%2Fapi%2FuploadSingleEmail%2Froute&appPaths=&pagePath=private-next-app-dir%2Fapi%2FuploadSingleEmail%2Froute.js&appDir=%2Fhome%2Farsl%2FWebstormProjects%2Fvisualprooffrontend%2Fapp&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&rootDir=%2Fhome%2Farsl%2FWebstormProjects%2Fvisualprooffrontend&isDev=true&tsconfigPath=tsconfig.json&basePath=&assetPrefix=&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D! (/home/arsl/WebstormProjects/visualprooffrontend/.next/server/app/api/uploadSingleEmail/route.js:429:1)
    at webpack_require (/home/arsl/WebstormProjects/visualprooffrontend/.next/server/webpack-runtime.js:33:43)
    at webpack_exec (/home/arsl/WebstormProjects/visualprooffrontend/.next/server/app/api/uploadSingleEmail/route.js:20356:39)
    at /home/arsl/WebstormProjects/visualprooffrontend/.next/server/app/api/uploadSingleEmail/route.js:20357:28
    at Object. (/home/arsl/WebstormProjects/visualprooffrontend/.next/server/app/api/uploadSingleEmail/route.js:20360:3)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at requirePage (/home/arsl/WebstormProjects/visualprooffrontend/node_modules/next/dist/server/require.js:112:75)
    at /home/arsl/WebstormProjects/visualprooffrontend/node_modules/next/dist/server/load-components.js:80:84
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async loadComponentsImpl (/home/arsl/WebstormProjects/visualprooffrontend/node_modules/next/dist/server/load-components.js:80:26)
    at async DevServer.findPageComponentsImpl (/home/arsl/WebstormProjects/visualprooffrontend/node_modules/next/dist/server/next-server.js:439:36) {
    digest: undefined
    }

charset encoding

in headerLines have
{ key: "content-type" line: "Content-Type: text/html; charset=gb2312" }
should be use charset gb2312 to decode.

I don't know header has content-type field it's standard behavior in .eml ๏ผŸ

I think can add options charset to decode content

How to make it work in the browser

I am trying to bring it in an HTML file as CDN to work in the browser and get the attachements out of an uploaded .eml file.
But there are require statements in the the Eml Parser code that prevent it to work from the browser
I tried a few bundlers, but they still contain the require statements
Do you have any suggestions on how to do it ?

ts declaration?

ts declaration is missing, could you add to that? - Thank you.

HTML stream results in error

const EmlParser = require('eml-parser');
const fs = require('fs');

let emailFile = fs.createReadStream('./EMAIL.eml');

new EmlParser(emailFile).convertEmailToStream('html')
.then(stream => {
stream.pipe(fs.createWriteStream(emailFile.path + '.html'));
})
.catch(err => {
console.log(err);
})


OUTPUT

$ node ./index.js
node:events:491
throw er; // Unhandled 'error' event
^

Error: ENOENT: no such file or directory, open 'C:\tmp\html-pdf-19868.html'
Emitted 'error' event on ReadStream instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:2

  1. {
    errno: -4058,
    code: 'ENOENT',
    syscall: 'open',
    path: 'C:\tmp\html-pdf-19868.html'
    }

Node.js v18.16.0

Embedded images not recognized as attachments

Embedded images not recognized as attachments.

I would like an option to extract and remove embedded images from the main body (and inserting a text saying that image was removed) and returned in the attachments array

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.