email parsing automation

Email Parser

Extract data from emails and automate your workflow

The forum is now read only. Please, go to the the main Email Parser website if you need help.
Need help configuring the program? Have any questions regarding its use?

Long story short (and probably a really easy question) we receive email CSV attachments as zips and need to import them into an SQL database.

We've look at various examples and we have all the looping, SQL etc all working. In fact i have a parse script that would read a .ZIP file extract it and then reading the results ready for my "rows" to populate and from there my regex expressions would extract columns ready for my SQL - all good all working. ie: emails with CSV attachments all work. ;-D

Where im stuck is within my ScriptBasedParser i need to be able to access/reference the email attachment some how.

I can see "message" items are accessible via the :ScriptBasedAction and also : ScriptBasedEmailFilter but how to do you do that in :ScriptBasedParser. Basically im replacing the built in "Attachment Reader" with my script to read the contents.


Code: Select allpublic class MyScriptBasedEmailParser : ScriptBasedParser // do not modify class name { public override List<string> ExtractTextFrom(string input_text) { List<string> captured_values = new List<string>(); string zipPath = {need this to be the attach zip in the email} . . . etc . . . return (captured_values); } }

I could probably create a filter that first extracts the file to a directory and later read in the ScriptBasedParser, but i kinda think its neater and more bullet proof :-)

many thanks in advance..

In Email Parser, attachments are usually read using the attachment reader. You already know this, but just wanted to highlight this for other users reading the forum. More info here:

But... if you want to access the file contents directly, as you noticed the ScriptBasedParser does not have access to the file itself. You would need to do this as a ScriptBasedAction and save the attachments first.

I have attached a screenshot that briefly show how to do it, however feel free to ask me for more details