If you're after text/* parts though. you can get them via connection.transaction.body[.children]
thezeroth
_smf_: just want to know, I can access them in queue plugins and create new mail json object sort of
?
_smf_
No; the transaction hooks run as the message comes in.
e.g. as the message is parsed
It really depends what you want to do.
Creating a JSON object with all the binary data also isn't going to work too well.
thezeroth
_smf_: I want to put the arrived email in to structured json with all attachments and stuff then pass that json obj to say rabbitmq
_smf_
thezeroth: but JSON doesn't support binary data?
thezeroth
_smf_: my attempt will be to upload that image on s3 and keep the link in my json object
_smf_
Then the attachment hooks are what you need.
thezeroth
_smf_: is there any doc about what all hooks are there and what they do
_smf_
Use then to create the S3 files and store the metadata e.g. filename, content-type, content-disposition, content-transfter-encoding and S3 location in transaction.notes.
thezeroth: you'll have to read everything in the docs/* directory on Github
thezeroth
_smf_: digging the same dir :)
_smf_
generally - there is one hook per SMTP command and the hooks fire in a logical order based on an SMTP transaction.
ultimatt2 joined the channel
thezeroth
understood thanks :)
DarkSorrow has quit
_smf_: give me some hit please, so as I said I have to make that object so I can create plugin which runs before Queues, like with data.headers ? and if yes how do I pass the new object forward to queue ?
_smf_
thezeroth: you'd build your structure inside a transaction note e.g. transaction.notes.json_obj = {}; and you can build up the structure as you go e.g. attachment_hooks etc. and then you simply take the object that you built and then in hook_queue you'd do something like var json = JSON.stringify(connection.transaction.notes.json_obj); and then pass the output to RabbitMQ or whatever.
That connection.notes, connection.transaction.notes structures are specifically designed with the need in mind that you'd want to share data between plugins.
thezeroth
_smf_: awesomeness I love this architecture of Haraka :)
_smf_
thezeroth: just a word of warning with the attachment_hooks; they're a bit 'tricky' to work with
I suggest you have a look at the attachment plugin as to how I handle them there.
thezeroth
_smf_: sure will do that :)
_smf_
Basically - you have have a hook_data_post function that waits for all of the attachment_hooks to complete.
Otherwise; what will happen is that Haraka will accept the message before they complete, which is bad ;-)
_smf_: yeah was reading that part in attachments plugins
_smf_
ultimatt2: not from me. baudehlo is going to be busy for the next week and a half as he has visitors.
thezeroth
_smf_: and just to make sure I dont face the json binary problem I will put that object in local db and pass the reference by rabbit mq
_smf_
thezeroth: why don't you just put the whole message in raw format inside the JSON?
thezeroth
_smf_: you mean base64 and stuff ?
_smf_
e.g. let whatever you're sending it to do the decoding.
Yeah
thezeroth
_smf_: thats the actual plan just before I send the real raw message to the receive I want to put this parts in json obj like in attachements array I will have objects with meta info of file + the base64 of the data if I get that done then I dont need db at all
because My receiver is in golang and goland dont have anything good to parse raw emails
golang*
baudehlo
I'm surprised.
You'd think someone would hve written something by now for go.
ultimatt2: yeah I saw it - not sure I have any problem with it specifically - I assume it solves some sort of problem.
ultimatt2
C has Makefile, perl has Makefile.PL, node.js has Gruntfile
there's a zillion handy little grunt tasks on npm that automate all sorts of tasks
like the included example, of checking your deps against npm version
that's the sort of thing I'll put in the wiki for releases, "run 'grunt versioncheck' and see if any modules *should* be updated (newer != better, use judgement!)"
baudehlo
right
and I guess you can do "grunt publish" which would do "git tag, git push --tags, npm publish"
ultimatt2
aye
I use grunt all over the place and have become quite fond of it
baudehlo
yeah then I'm down for the idea. Haven't looked at the PR itself.