*** Get a local referenece to the collection of of items in the current folder loItems = toFolder.Items *** Process all the items in the current folder *** If it is a mail item, save it and process the attachments IF VARTYPE( loItems ) = 'O' FOR EACH loItem IN loItems IF loItem.Class = 43 && olMail *** Add a record to the messages table *** store list of recipients as well lnCount = loItem.Recipients.Count lcRecip = '' FOR lnRecip = 1 TO lnCount loRecipient = loItem.Recipients[ lnRecip ] lcRecip = lcRecip + loRecipient.Name + ': ' + loRecipient.Address + CHR( 13 ) + CHR( 10 ) ENDFOR *** First see if the sender name actually IS an e-mail address IF '@' $ loItem.SenderName lcSenderEm2 = loItem.SenderName else if empty(loItem.To) *** don't reply - this is just a draft lcSenderEm2 = "Draft" else loReply = loItem.Reply() loRecip = loReply.Recipients[ 1 ] lcSenderEm2 = IIF( NOT EMPTY( loRecip.Address ), loRecip.Address, loRecip.Name ) endif ENDIF INSERT INTO SaveMail ( omInDate, omSender, omSubject, omBody, omFolder, omRecip, omSenderEm, omSenderEm2 ) ; VALUES ( loItem.ReceivedTime, loItem.SenderName, loItem.Subject, loItem.Body, toFolder.Name, lcRecip, lcSenderEm, lcSenderEm2 ) *** Now see if we have attachments IF loItem.Attachments.Count > 0 This.SaveAttachments( loItem ) ENDIF ENDIF ENDFOR ENDIF