IMAP Search skipping results

Bob Sneidar bobsneidar at iotecdigital.com
Fri Mar 20 11:10:29 EDT 2020


This version wraps ALL the tsNet calls in a try catch construct:

function IMAPGetHeaders pServer, pUser, pPass
   if pServer is empty then
      ask "Enter IMAP Server IP or address:" as sheet
      if the result is "Cancel" then return "Canceled."
      put it into pServer
   end if
   
   if pUser is empty then
      ask "Enter email address:" as sheet
      if the result is "Cancel" then return "Canceled."
      put it into pUser
   end if
   
   if pPass is empty then
      ask password "Enter password:" as sheet
      if the result is "Cancel" then return "Canceled."
      put it into pPass
   end if
   
   put pUser into tSettings["username"]
   put pPass into tSettings["password"]
   put empty into xHeaders
   
   try
      tsnetinit
      put tsNetCustomSync(pServer, \
            "SELECT INBOX",xHeaders,retHeaders,retResult, \
            retBytes,tSettings) into tStat
      put tsNetCustomSync(pServer, \
            "UID SEARCH NOT SEEN",xHeaders,retHeaders, \
            retResult,retBytes,tSettings) into tStat
   catch tError
      answer error "ERROR: " & tError as sheet
      breakpoint
   end try
   
   put word 3 to -1 of tStat into tUIDs
   put the number of words in tUIDs into sMsgCount
   return retHeaders &cr& tStat &cr& sMsgCount
end IMAPGetHeaders

> On Mar 20, 2020, at 08:06 , Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> This may be of more use. No functional changes, just something you can use to test against different IMAP servers:





More information about the use-livecode mailing list