MBF Knowledge Base

How do I parse an email in Haraka?

There are two things in Haraka that 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 infrmation 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 must be accessed via events on the transaction.