How to manipulate the 'attachment' of an inbound email (via Mailgun)?


#1

Happy Friday,

First, and sorry, I’m a kind of newbie in dev, and futhermore in Meteor…

What I try (hard) to achieve: my app ‘receives’ an inbound email (from Mailgun) with a well-formatted csv attached. I’d like my app to automatically load into my database the content of this simple csv.

How far I am (well not that far…): I’ve a server side route (Picker server side router) that ‘receives’ the Post request from Mailgun. And using Requestb.in I can see the full Post. It contains many things and something like this:

ea58ce18f72803161ee6cd04805c3f753e136969d6d2f342d0
--f2b1e7a1-52f5-4ea2-b9ab-4752f2889aa6
Content-Disposition: form-data; name="attachment-1"; filename="file.txt"
Content-Type: text/plain
Content-Length: 232

STUFF1  STUFF2  STUFF3
1212    42759   798909
1212    42759   798910
1212    42787   794073
1212    42787   794074
1212    42900   789562
1212    42909   790366
1212    42909   795138
1212    42909   795138
345 42909   795138
345 42909   795138
345 42909   795138
345 42909   795138
--f2b1e7a1-52f5-4ea2-b9ab-4752f2889aa6--

–> It’s perfect because it is the content of my file :slight_smile:

My problem: I have no idea how to be able to “manipulate”/ “retrieve”/ “access” this thing… And I didn’t find any clue on the web… Do you? I didn’t get any answer on SO…

If possible I’d like to make it simple (I’m not fond of super sophisticated NPM modules if it can be made simply in plain ‘old’ JS…). It’s - I think - a better way to learn… and I try to learn…

I could give you further details if needed.
Thank you very much for you help…