ankit1329 / eml-parser Goto Github PK
View Code? Open in Web Editor NEWParse .eml files. Convert .eml files to pdf, html, jpeg or png. Extract headers and attahments from .eml files.
License: MIT License
Parse .eml files. Convert .eml files to pdf, html, jpeg or png. Extract headers and attahments from .eml files.
License: MIT License
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 ?
is there any plan for typescript support?
ts declaration is missing, could you add to that? - Thank you.
@ankit1329 I'd like to open a pull request but I don't have permissions to create branches. Could you help me?
Originally posted by @danielmadureira in #5 (comment)
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
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!
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.
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
Node.js v18.16.0
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
error node_modules/eml-parser/index.js (23:17) @ EmlParser
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.