pe

parser_email

Email parser for Node.js

Showing:

Popularity

Downloads/wk

0

GitHub Stars

18

Maintenance

Last Commit

8yrs ago

Contributors

3

Package

Dependencies

0

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

parser_email

I needed a parser for Email, so I wrote one. At the moment it doesn't do much but parse the headers. Feel free to contribute.

Install

npm install parser_email

Example

This assumes that the file is saved somewhere on the file system, but it can easily be any type of incoming stream.

var   fs        = require('fs')
    , util      = require('util')
    , em_parse  = require('parser_email')

var mail = '';
var path_to_email = '~/emails/email.eml';

stream = fs.ReadStream(path_to_email);
stream.setEncoding('ascii');

stream.on('data', function(data) {
    mail += data;
});

stream.on('close', function () {
    parser = new em_parse(mail);

    //At the moment Email Parser emit's one event: part
    parser.on('part', function (type, body) {
        util.log('Received a part of type ' + type);
    });

    parser.execute();
});

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial