>LOCAL loOutlook,loNS,loInbox,loMailItems,lnCompteur,lnCount,lnCompteur2,lcAddress,llOk >loOutlook=CREATEOBJECT('Outlook.Application') >loNS=loOutlook.GetNameSpace('MAPI') >loInbox=loNS.Folders('Personal Folders').Folders('Spam') >loMailItems=loInbox.Items >CLOSE ALL >USE Email >lnCount=loMailItems.Count >lnCompteur2=0 >FOR lnCompteur=lnCount TO 1 STEP -1 > lnCompteur2=lnCompteur2+1 > WAIT WINDOW ALLTRIM(STR(lnCompteur2))+' of '+ALLTRIM(STR(lnCount)) NOWAIT > loItem=loMailItems.Item(lnCompteur) > APPEND BLANK > REPLACE AddDate WITH loItem.CreationTime > REPLACE Sender WITH loItem.SenderName > REPLACE Subject WITH loItem.Subject > IF LEN(ALLTRIM(loItem.Body))>0 > REPLACE Notes WITH loItem.Body > ELSE > REPLACE Notes WITH loItem.HTMLBody > ENDIF > REPLACE To WITH loItem.To > > * Sender email > lcAddress='' > IF '@'$Sender > lcAddress=Sender > ELSE > loReply=loItem.Reply() > llOk=.F. > > * First, lets try to get it from this method > IF TYPE('loReply.Recipients.Item(1)')='O' > IF '@'$loReply.Recipients.Item(1).Address > lcAddress=loReply.Recipients.Item(1).Address > llOk=.T. > ENDIF > ENDIF > > * If the first method failed > IF NOT llOk > IF TYPE('loReply.Recipients[1]')='O' > loRecipient=loReply.Recipients[1] > IF NOT EMPTY(loRecipient.Address) > IF '@'$loRecipient.Address > lcAddress=loRecipient.Address > ELSE > IF '@'$loRecipient.Name > lcAddress=loRecipient.Name > ENDIF > ENDIF > ELSE > IF '@'$loRecipient.Name > lcAddress=loRecipient.Name > ENDIF > ENDIF > ENDIF > ENDIF > > ENDIF > > REPLACE Address WITH LOWER(lcAddress) > > IF TYPE('loItem.Recipients.Item(1)')='O' > REPLACE ToAddress WITH LOWER(loItem.Recipients.Item(1).Address) > ENDIF > REPLACE NoMember WITH 1 >NEXT >WAIT CLEAR >BROWSE >SELECT TTOD(AddDate) AS AddDate,COUNT(*) AS Compte FROM Email GROUP BY 1 ORDER BY 1 DESC INTO CURSOR Temp >BROWSE >CLOSE ALL >>