I'm building a home project using EWS and SQLite. I have a bunch of really similar (and not so similar) Mails (that hava the usual subject sender body etc fields). These mails contain similar information and i would like to collect them into a sqlite db. Also i want to separete the collection logic from the main code (for mgmt purposes) so I was thinking an xml that would describe different conditions if which are met data collection begins according to that xml object eg.

<xml object>
<!--Regular expressions would be nice-->
<Body> ^Hello, <Body></and>

<Exmaple data1><Sbuject></Exmaple data1>
<Exmaple data2><Attachment Line=2></Exmaple data2>
<Exmaple data3><Mail header attribute=X-mailer></Exmaple data3> 
</xml object>

If the conditions are met the sqlite db would be updated with the Subject line, the second line from the atachment and the X-mailer property.

Any help is appreciated! Im open to throwing out my xml idea if there is a better existing lib for similar tasks.



Serializing your conditions and actions to an XML/JSON and put it aside is a plausible solution, albeit writing it to this format and parse it may be harder to implement and extend/maintain later.

Depending on your requirements and the system that you implement;

It may be more appropriate to create an object class that implements functions "match" (for the conditions) and "execute" (for the actions) and then:

  • serialize
  • put in an ORM db
  • pass them through a shared-memory data structure
  • etc.

And let the collector process/thread/system to receive the object and invoke match and (depending on its' result) execute.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.