Tim,
here is a simple funktion to get email from a pop server. It does neither handle attachments nor html emails. It´s out of one of my unfinished projects. I hope it helps you to get started.
METHOD GetMail () CLASS TEmail
LOCAL oPop
LOCAL aMsg := {}
LOCAL cPass := SPACE (20)
IF EMPTY (::cPass)
IF !::GetPass (@cPass)
RETURN (nil)
ENDIF
::SetPass (ALLTRIM (cPass))
ENDIF
::aMsgFiles := {} // Messagearray initialisieren
//oPop:=TPop():New( ::cPopServer, ::cLogin, ::cPass,,"Status.log")
oPop = TPop3():New( ::cPopServer,,; // mail server IP
::cLogin, ::cPass )
oPop:bConnecting := { || MsgRun ("Verbinde mit " + ::cPopServer,"Email abfragen")}
oPop:bConnected := { || MsgRun ("Verbunden ...","Email abfragen") }
oPop:bDone := { || aMsg := oPop:aMsg, ReadMails( aMsg ) }
oPop:GetMail()
//IF !oPop:lAllOk
// MsgInfo ("Fehler","Email abfragen")
//ENDIF
RETURN (nil)
//------------------------------------------------------------------
//
//
//------------------------------------------------------------------
Function ReadMails (aMsg)
LOCAL nMsg
LOCAL n
nMsg := LEN (aMsg) // Anzahl empfangener Nachrichten
IF nMsg > 0
FOR nMsg := 1 TO nMsg
// AADD (::aMsgFiles, oPop:aMsg[nMsg] ) // Dateinamen speichern
NEXT
ELSE
MsgInfo ("Keine neuen Nachrichten")
ENDIF
IF LEN (aMsg)>0
// ::MsgToArray () // Maildateien auslesen und in ::aInMail speichern
ENDIF
//IF ::lAutoSave
// ::MsgToDbf () // Nachrichten aus Array in DBF speichern
//ENDIF
RETURN (nil)