/*****************************************************************************/
Procedure Email_GetBody()
/*****************************************************************************/
lResetServer := oPopServer:Reset()
cMail := oPopServer:retrieve( Incomming.Messages.Value )
If oPopServer:lastErrorCode() != 0
MsgInfo( 'The message does not exist or was deleted ' + Chr( 10 ) +;
'Server responds : ' + oPopServer:lastErrorMessage() ,;
' Attention Message ' )
oPopServer:Close()
lOpen := .F.
Incomming.Connect.Enabled := .T.
Incomming.ReadTray.Enabled := .F.
Incomming.Messages.DeleteAllItems
Incomming.LabelServer.Hide
Incomming.LabelReply.Hide
Incomming.Server.Show
Incomming.cPass.Show
Incomming.cUser.Show
Incomming.User_1.Show
Incomming.Pass_1.Show
Return
Endif
aEmail := TIPMail():new()
oEmail := aEmail:fromString( cMail )
IF aEmail:isMultiPart()
// Retrieve all parts of a multipart message
aParts := aEmail:getMultiParts( )
/* through all parts of the eMail */
FOR EACH oPart IN aParts
IF .NOT. Empty( oPart:getFileName() )
If MsgYesNo(' download the attachment : ' + oPart:getFileName() , ;
' Select Y / N ' )
// This is a file attachment. Store it in the TMP folder.
IF .NOT. oPart:detachFile( cCurrentFolder+'\Attachment' )
MsgExclamation('Could not save the file : ' + oPart:getFileName() , ' !! Warning Message ¡¡ ' )
ENDIF
Endif
ELSE
CreateHtml(oPart:getBody() , oPart:GetFieldPart( "Content-Type" ))
Endif
NEXT
ELSE // Is simple eMail message
CreateHtml(aEmail:getBody() , aEmail:GetFieldPart( "Content-Type" ))
Endif
Return
THtml() is a class that creates an .html file of the same name you pass to the constructor.
The class methods are as follows:
New(<cFile>) Create a new instance of the THtml class
Close() Close the created file
WriteTitle(<cTitle>) Write the file title
WritePar(<cPar>) Writes a paragraph
WriteParBold(<cPar>) Same as WritePar(), but the text is
WriteLink(<cLink>,<cName>) Write a link to another topic
WriteText(<cText>) Write any text
IF aEmail:isMultiPart()
// odczytanie wszystkich cze˜ci wiadomo˜ci
// reading all parts of the message
aParts := aEmail:getMultiParts()
nPart := 0
FOR EACH oPart IN aParts
i got in aParts[1]:cBody what i want but i can't access it.
Error BASE/41 Scope violation (hidden): TIPMAIL:CBODY
Called from TIPMAIL:CBODY(0)
Called from GETEMAIL(436)
Called from (b)MAIN(81)
Called from _PROCESSINITPROCEDURE(5876)
Called from _ACTIVATEWINDOW(5627)
Called from MAIN(172)
who can help please.
Attachments
Pearl_Attachment.JPG (77.66 KiB) Viewed 2276 times
AUGE_OHR wrote: ↑Mon Nov 25, 2019 8:06 am
i have test it with QHTM() ... it work general but to much empty "frame" (did not download Images)
have to make more test to get "only" text to read