* If the POP3 control is connected. IF THISFORM.oPop3.STATE == 3 * This will be used to know how many email remain to be read. THISFORM.nPopMessageCount = THISFORM.oPop3.inbox.COUNT * If there are still emails to be processed. IF THISFORM.nPopMessageCount > 0 * Read the 1st one in the inbox. THISFORM.oPop3.retrievemessages(THISFORM.oPop3.inbox) * Store the 'Physical' email object into this variable. loMessage = THISFORM.oPop3.inbox.ITEM(0) * This will delete the email. Without flushing it's referance in the above variable. THISFORM.oPop3.DELETE(THISFORM.oPop3.inbox.ITEM(0)) ENDIF * Disconnect from the email server. THISFORM.oPop3.disconnect ENDIF
* If there was an email stored in this variable. IF VARTYPE(loMessage) == "O" * Store the senders email & subject * of the email into these variables lcMailFrom = loMessage.FROM.ADDRESS lcMailSubject = loMessage.subject * These are properties that can be used to know the format the email was sent in. lcCharSetEmail = ALLT(loMessage.contentsubtypeparameters) lcContentType = ALLTRIM(loMessage.ContentType) + "/" + ALLTRIM(loMessage.ContentSubtype) * This will be the date the email was sent lcCharSentTime = TTOC(loMessage.DATE) * These are the headers of the email. loHeader = loMessage.Headers ENDIFFor attachments, you will have use the "PARTS" Property of the email object.
IF loMessage.Parts.COUNT > 0 ENDIFThere is very good help on the mabry site about this.