views:

71

answers:

1

has anybody done anything with scripts to parse an incoming e mail to a specific address, strip out the data and insert it into a SQL database?

The e mail would be coming in through exchange 2003 server and would be in a known fixed format, ie

Name: Firstname Surname ID Number: nnnnnnn etc. etc.

Ideally the solution would need to operate on the server and not a client. Any advice appreciated.

Originally posted on serverfault but cross posted here for the scripting angle.

+1  A: 

Yes I have. What are you trying to accomplish with this?

If you want to know how to parse it, the easiest way I have found so far is to build a simple scraper/pattern matcher for your fixed format that doesn't change.

I generally have iterated though each line of the email looking for a specific element/identifier, after which i read so many characters to a variable for the row to be committed to the database.

SO:

  1. Download all emails

    1. loop through each email
    2. loop through each line in each email
    3. find each element, one at a time, in incremental order
  2. Delete emails from server..

Jas Panesar