(mostly answered on the Haraka mailing list already, but putting more here
so others can benefit)

There's two things in Haraka you have to do to get the email parsed:

1) set `connection.transaction.parse_body = true` in `hook_data` (or one of
the earlier hooks, but not before 'MAIL FROM' because that's when the
transaction is created).
2) read the stuff you want in `hook_data_post`. You get the body text or
html from `transaction.body` and the headers from `transaction.header`,

If you want access to the attachments they are streams, and accessed via
events on the transaction.

See the following doc pages:

http://haraka.github.io/manual/Transaction.html
http://haraka.github.io/manual/Body.html
http://haraka.github.io/manual/Header.html

Note some people don't like the way Haraka parses the email (it does
several things to make sure it is efficient, not necessarily easy to use).
If you don't like that you can pipe the `transaction.message_stream` into
the node "mailparser" module. See
https://github.com/andris9/mailparser#pipe-file-to-mailparser

On Mon, Jan 12, 2015 at 12:42 AM, Arman Ortega <[email protected]> wrote:

> Hi guys,
> Ive been exploring the haraka(node.js smtp server) and Ive successfully
> install it on my linux machine.
> I'm wondering if there is a good tutorial on parsing an email using
> haraka. Ive check on the manual but I couldn't find it.
> Any ideas/suggestions on how to do that would greatly appreciated. Thanks.
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/f3ab0927-636e-46e3-b638-83b3fbdea025%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/f3ab0927-636e-46e3-b638-83b3fbdea025%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAPJ5V2Y0gt4eDnyUJyuDmZJ%3D0yh8MSirf-VQoYQvFA8CJE81cA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to