How can I parse / map information that is in the body Field of an email to Notes Form on a separate database---Please help

Hi All,

I am getting an email in a mail box that contains information in the Body Field such as

First name:ac

Last name: ac

Date: 08/25.2008

Category Type: capillary

product1:

product2:

Title: Analyst

Organisation name: Semcor

Region: XYZ

Item Description: This is just a test information

Email ID of the person: xyz@gmail.com

and so on

I need to pass / map these fields in one of the Form that contain corresponding Fields in a separate database …called Information Log Database…

I need to create an agent in the Mail Database , --that will be run , when new mail arrives for every document that comes in the mail with subject “Contact _Us” in the subject line to automatically create documents in the Information log Database and parse /map information in the body field to the Document in the Information Log Database…

Please help

Thanks in advance,

ac ac

Subject: How can I parse / map information that is in the body Field of an email to Notes Form on a separate database—Please help

Search is a wonderful thing:

http://www-10.lotus.com/ldd/nd6forum.nsf/Search?SearchView&Query=parse%20and%20f%3Feld&SearchOrder=0&Start=1&Count=100

and

http://www-10.lotus.com/ldd/nd6forum.nsf/Search?SearchView&Query=parse%20and%20"rich%20text"&SearchOrder=0&Start=1&Count=100

See if you can find something that will get you started.

Doug

Subject: RE: How can I parse / map information that is in the body Field of an email to Notes Form on a separate database—Please help

Hi Doug,

Thanks for your quick resonse

Still not able to …figure it out …When I open the email that contains the body field , I see the Body Field of Data Type : MIME Part and I see Field properties of this Body Field only when I open the email …In the view mode , body Field property is not there …This mail Document is in a Database that is a Mail-In Database.

Thanks .

Please help

Regards,

ac ac

Subject: RE: How can I parse / map information that is in the body Field of an email to Notes Form on a separate database—Please help

If you can’t see the Body field in properties unless you open the message, then it sounds like the message is encrypted because the “Encrypt incoming mail” option is set to “Yes” in the Mail-In Database document in the Domino Directory.

If I am correct, that is a major complication. Your processing agent will have to run under an ID file that contains the private key required to decrypt the message. Agents run under the server’s ID file – setting the agent to run “On behalf” of a user does not change this – so the public key entered into the mail-in database document would have to be the server’s public key. And the problem with this is that only the server’s ID will be able to read the message in the mail-in database – i.e., no users will be able to read it. This may not be a problem for you if the only reason the database exists is so that your agent can process the messages – but it will certainly make debugging and maintenance difficult.

Subject: RE: How can I parse / map information that is in the body Field of an email to Notes Form on a separate database—Please help

Hi Rich,

I just checked the main -In Database Document on the server and Encrypt Incoming mail is set to “No”

Also I see the Body Field Type as Mime part now , while in a view when I do Document Properties …

For some reason I was not seeing earlier , but now I see…

The value of Body Field in Document Properties is " First name:ac

Last name: ac

Date: 08/25.2008

Category Type: capillary

product1:

product2:

Title: Analyst

Organisation name: Semcor

Region: XYZ

Item Description: This is just a test information

Email ID of the person: xyz@gmail.com "

Now how can I create another document and map these data …

Left of colon correspond to the Field name in another database and right of colon corresponds to value

Please help

Thanks & Regards,

ac ac

Subject: RE: How can I parse / map information that is in the body Field of an email to Notes Form on a separate database—Please help

One quick question. If this info is being submitted by a form in a database that you have control of (and not just one text field or an email template) you could parse the data when it’s submitted and format it with something like xml tags and then put it all in the body field of the memo: someValue…etc then just search for the values between the tags. That’s the best way if you have control over the submitting code. Otherwise it’s a tedious process.

We do something similar. Stand alone inbox. Processes docs and then moves them to a folder in the same database so they don’t get re-processed.

Subject: RE: How can I parse / map information that is in the body Field of an email to Notes Form on a separate database—Please help

Thanks Michael , for your quick response…I have no control over the Submitted code as it comes from a separate website…

If you could help me start , and the slowly I will progress and if I cannot will ask and repost my question…

Regards

ac ac

Subject: RE: How can I parse / map information that is in the body Field of an email to Notes Form on a separate database—Please help

Once you have a handle on the email document do something like this to move your script to where you want to start reading:

Sub GetyourValue (yourDoc As NotesDocument, currStr As String, yourValueVariable As string)

Dim val1 As Variant

Dim idx As Integer

Dim fin As String

fin = ""

Dim L As Long

Dim tstStr As String

tstStr =yourDoc.Body

'moves you down in the string (body) until you are just to the left of the value you want to grab. set currStr equal to whatever you want to search for.

val1 = Strrightback(tstStr , currStr )

L = Len(val1)

'moves you to the start of the value you want

While fin = ""

	If Left ( val1 , 1 ) = " " Then

		idx = idx + 1

		val1 = Right(val1  , L - idx )

	Else

		fin = "done"

	End If

Wend



'strips off everything to the right of the value you want

val1 = Strleft(val1  , " " )



yourValueVariable = val1

the code above was used to grab a value that didn’t have any blank spaces in it so, you will probably have to code around things like a firstNamelastName but, the code does work. Hopefully this sill give you a start.

I used the above as a sub routine and passed in the various strings I wanted to search for so you don’t have to re-write this for each search.