Example how to put de email from classe tpop3 in a database

Example how to put de email from classe tpop3 in a database

Postby JoseCarlos » Tue Mar 07, 2006 2:14 am

Hi

I test de class TPop3 and it works fine but i am with difficulty to separate the information for places them in dbf . The data of the email arrive all meetings and are with difficulty of separate them.

Somebody can help me with an example ?
José Carlos
JoseCarlos
 
Posts: 16
Joined: Tue Mar 07, 2006 2:02 am
Location: Guarulhos - Brasil

Postby JoseCarlos » Thu Mar 09, 2006 5:00 pm

Anybody knows ?
José Carlos
JoseCarlos
 
Posts: 16
Joined: Tue Mar 07, 2006 2:02 am
Location: Guarulhos - Brasil

Postby StefanHaupt » Fri Mar 10, 2006 9:13 am

Jose,

you can save the email into a ascii-file and then parse this file into an array. This array you can easily save in a dbf.

This is a sample to do it, depending on the fileformat you have change it, to fit your needs.

[code]
oFile := TTxtFile():New (aFile[i])
IF oFile != nil

DO WHILE !oFile:lEof() // lesen bis Dateiende
cTmp := oFile:ReadLn() // Zeile lesen

IF !EMPTY (cTmp) // Leer ??

IF AT (":",cTmp) > 0 // Neuer Abschnitt ?
cSection := ParseStr (1,":",cTmp)
cData := ALLTRIM (ParseStr (2,":",cTmp))
cData := IIF (EMPTY (cData), "", cData) // nil-Werte abfangen

DO CASE
CASE "RETURN" $ UPPER (cSection)
aMsg[RETURN_PATH] := cData
CASE "DATE" $ UPPER (cSection)
cData+=ParseStr(3,":",cTmp) // Uhrzeit ber
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby JoseCarlos » Fri Mar 10, 2006 2:55 pm

Stefan

Thank's for answering

Funtion "ParseStr" was not found. It could describes it?
José Carlos
JoseCarlos
 
Posts: 16
Joined: Tue Mar 07, 2006 2:02 am
Location: Guarulhos - Brasil

Postby StefanHaupt » Mon Mar 13, 2006 8:54 am

Jose,

You replace ParseString with StrToken that comes from fivewin

FUNCTION PARSESTR ( <nOccurrence>, <cSepChar>, <cText> )
RETURN (StrToken( <cText>, <nOccurrence> ,<cSepChar> ) )

Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby JoseCarlos » Mon Mar 13, 2006 11:44 pm

Thank's Stefan
José Carlos
JoseCarlos
 
Posts: 16
Joined: Tue Mar 07, 2006 2:02 am
Location: Guarulhos - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: George and 148 guests